8000 [Console] Fix a bug when passing a letter that could be an alias · symfony/symfony@c2904e1 · GitHub
[go: up one dir, main page]

Skip to content

Commit c2904e1

Browse files
author
Amrouche Hamza
committed
[Console] Fix a bug when passing a letter that could be an alias
1 parent e77545a commit c2904e1

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ public function hasParameterOption($values)
284284
}
285285

286286
if (0 === strpos($token, '-') && 0 !== strpos($token, '--')) {
287+
$token = explode('=', $token)[0];
287288
$searchableToken = str_replace('-', '', $token);
288289
$searchableValue = str_replace('-', '', $value);
289290
if ('' !== $searchableToken && '' !== $searchableValue && false !== strpos($searchableToken, $searchableValue)) {

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,9 @@ public function testHasParameterOption()
299299
$input = new ArgvInput(array('cli.php', '-fh'));
300300
$this->assertTrue($input->hasParameterOption('-fh'), '->hasParameterOption() returns true if the given short option is in the raw input');
301301

302+
$input = new ArgvInput(array('cli.php', '-e=test'));
303+
$this->assertFalse($input->hasParameterOption('-s'), '->hasParameterOption() returns true if the given short option is in the raw input');
304+
302305
$input = new ArgvInput(array('cli.php', '--foo', 'foo'));
303306
$this->assertTrue($input->hasParameterOption('--foo'), '->hasParameterOption() returns true if the given short option is in the raw input');
304307

0 commit comments

Comments
 (0)
0