Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1276d32

Browse filesBrowse files
committed
bug #45240 [Console] Revert StringInput bc break from #45088 (bobthecow)
This PR was merged into the 4.4 branch. Discussion ---------- [Console] Revert StringInput bc break from #45088 | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix bobthecow/psysh#703 | License | MIT | Doc PR | - Fix a backwards compatibility break introduced in #45088 and released in v4.4.37, v5.3.14, v5.4.3 and v6.0.3. I went with `REGEX_UNQUOTED_STRING` by analog to the `REGEX_QUOTED_STRING` constant name, but don't have a strong opinion on what it should be called :) Commits ------- aab2f2a [Console] Revert StringInput bc break from #45088
2 parents 109257d + aab2f2a commit 1276d32
Copy full SHA for 1276d32

File tree

1 file changed

+3
-2
lines changed
Filter options

1 file changed

+3
-2
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Input/StringInput.php
+3-2Lines 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)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.