8000 bug #24987 [Console] Fix global console flag when used in chain (Simp… · symfony/symfony@9107fb0 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9107fb0

Browse files
author
Robin Chalas
committed
bug #24987 [Console] Fix global console flag when used in chain (Simperfit)
This PR was merged into the 2.7 branch. Discussion ---------- [Console] Fix global console flag when used in chain | 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 | #23876 | License | MIT | Doc PR | Because SymfonyCon is great we can create pull request in it ! (this was preparer in the plane and I can push it just right now ;)) Finished in the #SymfonyConHackday2017 Commits ------- 1f8db73 [Console] Fix global console flag when used in chain
2 parents abe6e92 + 1f8db73 commit 9107fb0

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,14 @@ public function hasParameterOption($values)
282282
if ($token === $value || 0 === strpos($token, $value.'=')) {
283283
return true;
284284
}
285+
286+
if (0 === strpos($token, '-') && 0 !== strpos($token, '--')) {
287+
$searchableToken = str_replace('-', '', $token);
288+
$searchableValue = str_replace('-', '', $value);
289+
if ('' !== $searchableToken && '' !== $searchableValue && false !== strpos($searchableToken, $searchableValue)) {
290+
return true;
291+
}
292+
}
285293
}
286294
}
287295

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

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

299+
$input = new ArgvInput(array('cli.php', '-fh'));
300+
$this->assertTrue($input->hasParameterOption('-fh'), '->hasParameterOption() returns true if the given short option is in the raw input');
301+
299302
$input = new ArgvInput(array('cli.php', '--foo', 'foo'));
300303
$this->assertTrue($input->hasParameterOption('--foo'), '->hasParameterOption() returns true if the given short option is in the raw input');
301304

0 commit comments

Comments
 (0)
0