Skip to content

Commit

Permalink
[Console] Fix PHP 8.1 null error for preg_match flag
Browse files Browse the repository at this point in the history
Since PHP 8.1, null is no longer accepted as $flags, default integer `0` value should be used instead.
  • Loading branch information
kylekatarnls committed Feb 14, 2021
1 parent a10b1da commit 271b628
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Input/StringInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ private function tokenize($input)
$length = \strlen($input);
$cursor = 0;
while ($cursor < $length) {
if (preg_match('/\s+/A', $input, $match, null, $cursor)) {
} elseif (preg_match('/([^="\'\s]+?)(=?)('.self::REGEX_QUOTED_STRING.'+)/A', $input, $match, null, $cursor)) {
if (preg_match('/\s+/A', $input, $match, 0, $cursor)) {
} elseif (preg_match('/([^="\'\s]+?)(=?)('.self::REGEX_QUOTED_STRING.'+)/A', $input, $match, 0, $cursor)) {
$tokens[] = $match[1].$match[2].stripcslashes(str_replace(['"\'', '\'"', '\'\'', '""'], '', substr($match[3], 1, \strlen($match[3]) - 2)));
} elseif (preg_match('/'.self::REGEX_QUOTED_STRING.'/A', $input, $match, null, $cursor)) {
} elseif (preg_match('/'.self::REGEX_QUOTED_STRING.'/A', $input, $match, 0, $cursor)) {
$tokens[] = stripcslashes(substr($match[0], 1, \strlen($match[0]) - 2));
} elseif (preg_match('/'.self::REGEX_STRING.'/A', $input, $match, null, $cursor)) {
} elseif (preg_match('/'.self::REGEX_STRING.'/A', $input, $match, 0, $cursor)) {
$tokens[] = stripcslashes($match[1]);
} else {
// should never happen
Expand Down

0 comments on commit 271b628

Please sign in to comment.