Skip to content

Commit 6bfa357

Browse files
authored
[BUGFIX] Use safe preg functions in CSSString (#1382)
Part of #1168
1 parent 9ad776b commit 6bfa357

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Please also have a look at our
1818

1919
### Fixed
2020

21-
- Use typesafe versions of PHP functions (#1379, #1380)
21+
- Use typesafe versions of PHP functions (#1379, #1380, #1382)
2222

2323
### Documentation
2424

src/Value/CSSString.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
use Sabberworm\CSS\Parsing\UnexpectedEOFException;
1111
use Sabberworm\CSS\Parsing\UnexpectedTokenException;
1212

13+
use function Safe\preg_match;
14+
1315
/**
1416
* This class is a wrapper for quoted strings to distinguish them from keywords.
1517
*
@@ -54,7 +56,7 @@ public static function parse(ParserState $parserState): CSSString
5456
$content = null;
5557
if ($quote === null) {
5658
// Unquoted strings end in whitespace or with braces, brackets, parentheses
57-
while (\preg_match('/[\\s{}()<>\\[\\]]/isu', $parserState->peek()) !== 1) {
59+
while (preg_match('/[\\s{}()<>\\[\\]]/isu', $parserState->peek()) === 0) {
5860
$result .= $parserState->parseCharacter(false);
5961
}
6062
} else {

0 commit comments

Comments
 (0)