Simplified code, enhanced PHPDocs

This commit is contained in:
SilverFire - Dmitry Naumenko
2018-03-10 10:19:07 +02:00
parent e72c31dc0b
commit b3f54d1065
3 changed files with 9 additions and 9 deletions

View File

@ -1255,14 +1255,13 @@ class BaseHtml
$lines = array_unique(array_merge($lines, $model->getErrorSummary($showAllErrors)));
}
// Fix #15858 (FlorinRo) - If there are same message errors for different attributes, array_unique could skip some array key,
// so the next for cycle could fail because key missing.
// Applying array_values reorder array keys.
// If there are the same error messages for different attributes, array_unique will leave gaps
// between sequential keys. Applying array_values to reorder array keys.
$lines = array_values($lines);
if ($encode) {
for ($i = 0, $linesCount = count($lines); $i < $linesCount; $i++) {
$lines[$i] = Html::encode($lines[$i]);
foreach ($lines as &$line) {
$line = Html::encode($line);
}
}