Use strpos in place of substr

This commit is contained in:
Lee McDermott 2013-01-06 02:24:44 +00:00
parent 9864d9572d
commit 8a0bcfbed2

View File

@ -162,10 +162,8 @@ class DialogHelper extends Helper
$ofs = 0; $ofs = 0;
foreach ($autocomplete as $value) { foreach ($autocomplete as $value) {
// Get a substring of the current autocomplete item based on number of chars typed (e.g. AcmeDemoBundle = Acme) // If typed characters match the beginning chunk of value (e.g. [AcmeDe]moBundle)
$matchTest = substr($value, 0, $i); if (0 === strpos($value, $ret) && $i !== strlen($value)) {
if ($ret === $matchTest && $i !== strlen($value)) {
$matches[$numMatches++] = $value; $matches[$numMatches++] = $value;
} }
} }