Skip to content

Commit e93d24f

Browse files
committed
Switch to addclashes
1 parent 90d1602 commit e93d24f

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

src/Value/CSSString.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,9 @@ public function getArrayRepresentation(): array
114114

115115
private function escape(string $string, string $quote): string
116116
{
117-
$string = \addslashes($string);
117+
$charactersToEscape = '\\';
118+
$charactersToEscape .= ($quote === '"' ? '"' : "'");
118119

119-
$replace = $quote === '"' ? ["\\'" => "'"] : ['\\"' => '"'];
120-
121-
return \str_replace(array_keys($replace), array_values($replace), $string);
120+
return \addcslashes($string, $charactersToEscape);
122121
}
123122
}

0 commit comments

Comments
 (0)