Fixes #11863: Fixed usage of mb_substr with PHP < 5.4.8 where length of NULL was treated the same as 0

This commit is contained in:
Alexander Makarov
2016-07-02 21:06:39 +03:00
parent 779c8e0a01
commit 3b5634bf8b
4 changed files with 6 additions and 4 deletions

View File

@ -232,7 +232,7 @@ class BaseStringHelper
}
return substr_compare($string, $with, -$bytes, $bytes) === 0;
} else {
return mb_strtolower(mb_substr($string, -$bytes, null, '8bit'), Yii::$app->charset) === mb_strtolower($with, Yii::$app->charset);
return mb_strtolower(mb_substr($string, -$bytes, mb_strlen($string, '8bit'), '8bit'), Yii::$app->charset) === mb_strtolower($with, Yii::$app->charset);
}
}