[Console] fixed corrupt error output for unknown multibyte short option
This commit is contained in:
parent
d32d7685c2
commit
0f861568aa
@ -121,7 +121,8 @@ class ArgvInput extends Input
|
||||
$len = \strlen($name);
|
||||
for ($i = 0; $i < $len; ++$i) {
|
||||
if (!$this->definition->hasShortcut($name[$i])) {
|
||||
throw new RuntimeException(sprintf('The "-%s" option does not exist.', $name[$i]));
|
||||
$encoding = mb_detect_encoding($name, null, true);
|
||||
throw new RuntimeException(sprintf('The "-%s" option does not exist.', false === $encoding ? $name[$i] : mb_substr($name, $i, 1, $encoding)));
|
||||
}
|
||||
|
||||
$option = $this->definition->getOptionForShortcut($name[$i]);
|
||||
|
@ -228,6 +228,11 @@ class ArgvInputTest extends TestCase
|
||||
new InputDefinition(array(new InputArgument('number'))),
|
||||
'The "-1" option does not exist.',
|
||||
),
|
||||
array(
|
||||
array('cli.php', '-fЩ'),
|
||||
new InputDefinition(array(new InputOption('foo', 'f', InputOption::VALUE_NONE))),
|
||||
'The "-Щ" option does not exist.',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user