Permalink
Browse files

Use strpos in place of substr

  • Loading branch information...
1 parent 9864d95 commit 8a0bcfbed28993fe7085a28128babd5fca011ac8 @lmcd lmcd committed Jan 6, 2013
Showing with 2 additions and 4 deletions.
  1. +2 −4 src/Symfony/Component/Console/Helper/DialogHelper.php
@@ -162,10 +162,8 @@ public function ask(OutputInterface $output, $question, $default = null, array $
$ofs = 0;
foreach ($autocomplete as $value) {
- // Get a substring of the current autocomplete item based on number of chars typed (e.g. AcmeDemoBundle = Acme)
- $matchTest = substr($value, 0, $i);
-
- if ($ret === $matchTest && $i !== strlen($value)) {
+ // If typed characters match the beginning chunk of value (e.g. [AcmeDe]moBundle)
+ if (0 === strpos($value, $ret) && $i !== strlen($value)) {
$matches[$numMatches++] = $value;
}
}

0 comments on commit 8a0bcfb

Please sign in to comment.