aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Lange <code@nerdmind.de>2024-02-02 20:25:07 +0100
committerThomas Lange <code@nerdmind.de>2024-02-02 20:42:03 +0100
commit8803801d5d0443c89e4e325e800ba0c2113885fe (patch)
tree84e734b17858464c68d2fb93b7b3cecb8fa2183d
parent0563e596ce66048f327315a74c00fdb3a6a98951 (diff)
downloadblog-8803801d5d0443c89e4e325e800ba0c2113885fe.tar.gz
blog-8803801d5d0443c89e4e325e800ba0c2113885fe.tar.xz
blog-8803801d5d0443c89e4e325e800ba0c2113885fe.zip
Fix incorrect backslash escaping of `\\`
The regular expression part `\\` must be written as `\\\\`, not `\\\` in a PHP string variable. Although both variants (`\\\\` and `\\\`) will be passed as `\` to the regex engine in this specific case, it's correct to use 4 backslashes, as the PHP manual tells you: https://www.php.net/manual/en/regexp.reference.escape.php
-rw-r--r--core/namespace/Parsers/FunctionParser.php4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/namespace/Parsers/FunctionParser.php b/core/namespace/Parsers/FunctionParser.php
index 5b2656e..02570a0 100644
--- a/core/namespace/Parsers/FunctionParser.php
+++ b/core/namespace/Parsers/FunctionParser.php
@@ -26,8 +26,8 @@ class FunctionParser implements ParserInterface {
private const ARGUMENT_PATTERN_PARTIAL =
'(?<arg> # Either a quoted string or a plain number
(?<qmark>["\']) # Either a single or double quote
- (?>[^"\'\\\]++ # String between the quotes
- | [\\\]. # A `\` followed by anything but literal newline
+ (?>[^"\'\\\\]++ # String between the quotes
+ | [\\\\]. # A `\` followed by anything but literal newline
| (?!\k<qmark>)["\'] # A quote, but not our opening quote
)*+
\k<qmark> # Closing quote (same as opening quote)