Skip to content

Commit

Permalink
Fix yiisoft#20042: Add empty array check to `ActiveQueryTrait::findWi…
Browse files Browse the repository at this point in the history
…th()`
  • Loading branch information
Renkas authored Oct 25, 2023
1 parent 9d3c71d commit 7005d27
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions framework/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Yii Framework 2 Change Log
- Bug #20002: Fixed superfluous query on HEAD request in serializer (xicond)
- Enh #12743: Added new methods `BaseActiveRecord::loadRelations()` and `BaseActiveRecord::loadRelationsFor()` to eager load related models for existing primary model instances (PowerGamer1)
- Enh #20030: Improve performance of handling `ErrorHandler::$memoryReserveSize` (antonshevelev, rob006)
- Enh #20042: Add empty array check to `ActiveQueryTrait::findWith()` (renkas)
- Enh #20032: Added `mask` method for string masking with multibyte support (salehhashemi1992)


Expand Down
4 changes: 4 additions & 0 deletions framework/db/ActiveQueryTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@ protected function createModels($rows)
*/
public function findWith($with, &$models)
{
if (empty($models)) {
return;
}

$primaryModel = reset($models);
if (!$primaryModel instanceof ActiveRecordInterface) {
/* @var $modelClass ActiveRecordInterface */
Expand Down

0 comments on commit 7005d27

Please sign in to comment.