Fixes #13845: mt_rand() is not used instead of rand() in yii\captcha\CaptchaAction + minor code improvements

This commit is contained in:
Vladimir Reznichenko
2017-03-24 06:14:48 +01:00
committed by Alexander Makarov
parent 7e1a050a16
commit 6da1ec6fb2
7 changed files with 13 additions and 12 deletions

View File

@ -1221,7 +1221,7 @@ class BaseHtml
foreach ($model->getErrors() as $errors) {
foreach ($errors as $error) {
$line = $encode ? Html::encode($error) : $error;
if (array_search($line, $lines) === false) {
if (!in_array($line, $lines, true)) {
$lines[] = $line;
}
if (!$showAllErrors) {

View File

@ -362,7 +362,7 @@ class BaseInflector
*/
public static function camel2words($name, $ucwords = true)
{
$label = trim(strtolower(str_replace([
$label = strtolower(trim(str_replace([
'-',
'_',
'.',
@ -384,9 +384,9 @@ class BaseInflector
{
$regex = $strict ? '/[A-Z]/' : '/(?<![A-Z])[A-Z]/';
if ($separator === '_') {
return trim(strtolower(preg_replace($regex, '_\0', $name)), '_');
return strtolower(trim(preg_replace($regex, '_\0', $name), '_'));
} else {
return trim(strtolower(str_replace('_', $separator, preg_replace($regex, $separator . '\0', $name))), $separator);
return strtolower(trim(str_replace('_', $separator, preg_replace($regex, $separator . '\0', $name)), $separator));
}
}