Merge pull request #2010 from open-sausages/pulls/4.0/deprecated-each

BUG Remove usage of deprecated each()
This commit is contained in:
Chris Joe 2017-11-08 16:32:25 +13:00 committed by GitHub
commit 365eabb85a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -203,9 +203,11 @@ class SearchForm extends Form
// Add * to each keyword
$splitWords = preg_split("/ +/", trim($keywords));
$newWords = [];
while (list($i,$word) = each($splitWords)) {
for ($i = 0; $i < count($splitWords); $i++) {
$word = $splitWords[$i];
if ($word[0] == '"') {
while (list($i,$subword) = each($splitWords)) {
while (++$i < count($splitWords)) {
$subword = $splitWords[$i];
$word .= ' ' . $subword;
if (substr($subword, -1) == '"') {
break;