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 ccc9367

Browse filesBrowse files
committed
bug #25487 [Console] Fix a bug when passing a letter that could be an alias (Simperfit)
This PR was merged into the 2.7 branch. Discussion ---------- [Console] Fix a bug when passing a letter that could be an alias | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | yes | New feature? | no <!-- don't forget to update src/**/CHANGELOG.md files --> | BC breaks? | no | Deprecations? | no <!-- don't forget to update UPGRADE-*.md files --> | Tests pass? | yes | Fixed tickets | see #24987 (comment) | License | MIT | Doc PR | Fixing the global in console commands I've introduced a bug where when you pass -e=test it finds it a --shell, this fix the wrong behaviour. cc @Zwartpet Commits ------- a8871de [Console] Fix a bug when passing a letter that could be an alias
2 parents e77545a + a8871de commit ccc9367
Copy full SHA for ccc9367

File tree

2 files changed

+5
-0
lines changed
Filter options

2 files changed

+5
-0
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Input/ArgvInput.php
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,8 @@ public function hasParameterOption($values)
284284
}
285285

286286
if (0 === strpos($token, '-') && 0 !== strpos($token, '--')) {
287+
$noValue = explode('=', $token);
288+
$token = $noValue[0];
287289
$searchableToken = str_replace('-', '', $token);
288290
$searchableValue = str_replace('-', '', $value);
289291
if ('' !== $searchableToken && '' !== $searchableValue && false !== strpos($searchableToken, $searchableValue)) {

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

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