Fix #19743: Non-associative array values in AR weren't considered dirty when reordered

This commit is contained in:
Alexander Makarov
2023-05-21 12:06:16 +03:00
committed by GitHub
parent 301a1cf0e3
commit a8e83abd8f
2 changed files with 2 additions and 1 deletions

View File

@ -4,6 +4,7 @@ Yii Framework 2 Change Log
2.0.48 under development
------------------------
- Bug #19743: Non-associative array values in AR weren't considered dirty when reordered (samdark)
- Bug #19807: Fix REST serializer not using `serializeModel()` when working with array of models (zucha)
- Enh #19766: Add support for PHP generators to JSON helper (vladis84)
- Bug #19683: Updated `framework\mimeType.php` to the actual value. Fix typo in `build/controllers/MimeTypeController.php` (DeryabinSergey)

View File

@ -1763,7 +1763,7 @@ abstract class BaseActiveRecord extends Model implements ActiveRecordInterface
*/
private function isValueDifferent($newValue, $oldValue)
{
if (is_array($newValue) && is_array($oldValue)) {
if (is_array($newValue) && is_array($oldValue) && !ArrayHelper::isAssociative($oldValue)) {
$newValue = ArrayHelper::recursiveSort($newValue);
$oldValue = ArrayHelper::recursiveSort($oldValue);
}