10000 bug #45590 [Console] Revert StringInput bc break from #45088 (bobthecow) · jayminsilicon/symfony@84f0d0e · GitHub
[go: up one dir, main page]

Skip to content

Commit 84f0d0e

Browse files
committed
bug symfony#45590 [Console] Revert StringInput bc break from symfony#45088 (bobthecow)
This PR was merged into the 5.3 branch. Discussion ---------- [Console] Revert StringInput bc break from symfony#45088 | Q | A | ------------- | --- | Branch? | 5.3 <!-- see below --> | Bug fix? | yes (BC break) | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | Refs symfony#45088<!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead --> | License | MIT | Doc PR | n/a Commits ------- e978194 [Console] Revert StringInput bc break from symfony#45088
2 parents 9447827 + e978194 commit 84f0d0e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

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

B5F0
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
*/
2525
class StringInput extends ArgvInput
2626
{
27-
public const REGEX_STRING = '([^\s\\\\]+?)';
27+
public const REGEX_STRING = '([^\s]+?)(?:\s|(?<!\\\\)"|(?<!\\\\)\'|$)';
28+
public const REGEX_UNQUOTED_STRING = '([^\s\\\\]+?)';
2829
public const REGEX_QUOTED_STRING = '(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\')';
2930

3031
/**
@@ -64,7 +65,7 @@ private function tokenize(string $input): array
6465
$token .= $match[1].$match[2].stripcslashes(str_replace(['"\'', '\'"', '\'\'', '""'], '', substr($match[3], 1, -1)));
6566
} elseif (preg_match('/'.self::REGEX_QUOTED_STRING.'/A', $input, $match, 0, $cursor)) {
6667
$token .= stripcslashes(substr($match[0], 1, -1));
67-
} elseif (preg_match('/'.self::REGEX_STRING.'/A', $input, $match, 0, $cursor)) {
68+
} elseif (preg_match('/'.self::REGEX_UNQUOTED_STRING.'/A', $input, $match, 0, $cursor)) {
6869
$token .= $match[1];
6970
} else {
7071
// should never happen

0 commit comments

Comments
 (0)
0