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 0f86156

Browse filesBrowse files
downaceRobin Chalas
authored and
Robin Chalas
committed
[Console] fixed corrupt error output for unknown multibyte short option
1 parent d32d768 commit 0f86156
Copy full SHA for 0f86156

File tree

Expand file treeCollapse file tree

2 files changed

+7
-1
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+7
-1
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Input/ArgvInput.php
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,8 @@ private function parseShortOptionSet($name)
121121
$len = \strlen($name);
122122
for ($i = 0; $i < $len; ++$i) {
123123
if (!$this->definition->hasShortcut($name[$i])) {
124-
throw new RuntimeException(sprintf('The "-%s" option does not exist.', $name[$i]));
124+
$encoding = mb_detect_encoding($name, null, true);
125+
throw new RuntimeException(sprintf('The "-%s" option does not exist.', false === $encoding ? $name[$i] : mb_substr($name, $i, 1, $encoding)));
125126
}
126127

127128
$option = $this->definition->getOptionForShortcut($name[$i]);

‎src/Symfony/Component/Console/Tests/Input/ArgvInputTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Tests/Input/ArgvInputTest.php
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,11 @@ public function provideInvalidInput()
228228
new InputDefinition(array(new InputArgument('number'))),
229229
'The "-1" option does not exist.',
230230
),
231+
array(
232+
array('cli.php', '-fЩ'),
233+
new InputDefinition(array(new InputOption('foo', 'f', InputOption::VALUE_NONE))),
234+
'The "-Щ" option does not exist.',
235+
),
231236
);
232237
}
233238

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.