Improved XLSX Escaper performance for strings with only common/safe characters.
This commit is contained in:
parent
277c353984
commit
a281bee7d6
@ -95,6 +95,10 @@ class XLSX implements EscaperInterface
|
|||||||
*/
|
*/
|
||||||
protected function escapeControlCharacters($string)
|
protected function escapeControlCharacters($string)
|
||||||
{
|
{
|
||||||
|
if (1 !== preg_match('~[^A-Za-z0-9\-.:, ]~', $string)) {
|
||||||
|
return $string;
|
||||||
|
}
|
||||||
|
|
||||||
$escapedString = $this->escapeEscapeCharacter($string);
|
$escapedString = $this->escapeEscapeCharacter($string);
|
||||||
return str_replace(array_values($this->controlCharactersEscapingMap), array_keys($this->controlCharactersEscapingMap), $escapedString);
|
return str_replace(array_values($this->controlCharactersEscapingMap), array_keys($this->controlCharactersEscapingMap), $escapedString);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user