Browse Source

Fix #18308: Fixed `\yii\base\Model::getErrorSummary()` reverse order

tags/2.0.39
DrDeath72 4 years ago committed by GitHub
parent
commit
0210999748
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      framework/CHANGELOG.md
  2. 2
      framework/base/Model.php
  3. 4
      tests/framework/base/ModelTest.php

1
framework/CHANGELOG.md

@ -6,6 +6,7 @@ Yii Framework 2 Change Log
- Bug #16418: Fixed `yii\data\Pagination::getLinks()` to return links to the first and the last pages regardless of the current page (ptz-nerf, bizley)
- Bug #18297: Replace usage of deprecated `ReflectionParameter::isArray()` method in PHP8 (baletskyi)
- Bug #18308: Fixed `\yii\base\Model::getErrorSummary()` reverse order (DrDeath72)
2.0.38 September 14, 2020

2
framework/base/Model.php

@ -639,7 +639,7 @@ class Model extends Component implements StaticInstanceInterface, IteratorAggreg
$lines = [];
$errors = $showAllErrors ? $this->getErrors() : $this->getFirstErrors();
foreach ($errors as $es) {
$lines = array_merge((array)$es, $lines);
$lines = array_merge($lines, (array)$es);
}
return $lines;
}

4
tests/framework/base/ModelTest.php

@ -322,8 +322,8 @@ class ModelTest extends TestCase
'lastName' => ['Another one!'],
], $speaker->getErrors());
$this->assertEquals(['Another one!', 'Something is wrong!', 'Totally wrong!'], $speaker->getErrorSummary(true));
$this->assertEquals(['Another one!', 'Something is wrong!'], $speaker->getErrorSummary(false));
$this->assertEquals(['Something is wrong!', 'Totally wrong!', 'Another one!'], $speaker->getErrorSummary(true));
$this->assertEquals(['Something is wrong!', 'Another one!'], $speaker->getErrorSummary(false));
$speaker->clearErrors('firstName');
$this->assertEquals([

Loading…
Cancel
Save