From 5ded6d8b2d27313f6f0d3116fc301c2c52f3cf51 Mon Sep 17 00:00:00 2001 From: Oliver Klee Date: Thu, 21 Aug 2025 20:21:23 +0200 Subject: [PATCH 1/2] [BUGFIX] Use the safe regexp functions in `CSSList` --- CHANGELOG.md | 2 ++ src/CSSList/CSSList.php | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 72a6cb3b..e3aa7db1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,8 @@ Please also have a look at our ### Fixed +- Use typesafe versions of PHP functions (#1368) + ### Documentation ## 9.0.0: New features, deprecation removals and bug fixes diff --git a/src/CSSList/CSSList.php b/src/CSSList/CSSList.php index ee09b79e..d68a8c3b 100644 --- a/src/CSSList/CSSList.php +++ b/src/CSSList/CSSList.php @@ -242,7 +242,7 @@ private static function identifierIs(string $identifier, string $match): bool return true; } - return \preg_match("/^(-\\w+-)?$match$/i", $identifier) === 1; + return preg_match("/^(-\\w+-)?$match$/i", $identifier) === 1; } /** From e4e4044cce4a7603050e91c14d8d600a2a5e6435 Mon Sep 17 00:00:00 2001 From: Oliver Klee Date: Fri, 22 Aug 2025 10:54:27 +0200 Subject: [PATCH 2/2] `use` it --- src/CSSList/CSSList.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/CSSList/CSSList.php b/src/CSSList/CSSList.php index d68a8c3b..e09a03a9 100644 --- a/src/CSSList/CSSList.php +++ b/src/CSSList/CSSList.php @@ -25,6 +25,8 @@ use Sabberworm\CSS\Value\URL; use Sabberworm\CSS\Value\Value; +use function Safe\preg_match; + /** * This is the most generic container available. It can contain `DeclarationBlock`s (rule sets with a selector), * `RuleSet`s as well as other `CSSList` objects.