Skip to content

Commit ad6c725

Browse files
committed
[Console] Revert StringInput bc break from #45088
1 parent 109257d commit ad6c725

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Symfony/Component/Console/Input/StringInput.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@
2424
*/
2525
class StringInput extends ArgvInput
2626
{
27-
public const REGEX_STRING = '([^\s\\\\]+?)';
27+
// @deprecated constant replaced by REGEX_UNQUOTED_STRING, to be removed in Symfony 7.0
28+
public const REGEX_STRING = '([^\s]+?)(?:\s|(?<!\\\\)"|(?<!\\\\)\'|$)';
29+
public const REGEX_UNQUOTED_STRING = '([^\s\\\\]+?)';
2830
public const REGEX_QUOTED_STRING = '(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\')';
2931

3032
/**
@@ -64,7 +66,7 @@ private function tokenize(string $input): array
6466
$token .= $match[1].$match[2].stripcslashes(str_replace(['"\'', '\'"', '\'\'', '""'], '', substr($match[3], 1, -1)));
6567
} elseif (preg_match('/'.self::REGEX_QUOTED_STRING.'/A', $input, $match, 0, $cursor)) {
6668
$token .= stripcslashes(substr($match[0], 1, -1));
67-
} elseif (preg_match('/'.self::REGEX_STRING.'/A', $input, $match, 0, $cursor)) {
69+
} elseif (preg_match('/'.self::REGEX_UNQUOTED_STRING.'/A', $input, $match, 0, $cursor)) {
6870
$token .= $match[1];
6971
} else {
7072
// should never happen

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy