Skip to content

Commit

Permalink
Update ActiveRelationTrait.php
Browse files Browse the repository at this point in the history
Fix for PHP 7.4

Trying to access array offset on value of type null
When:
if (($value = $model[$attribute]) !== null) 

/var/www/builds/cms/3.6.0/vendor/yiisoft/yii2/db/ActiveRelationTrait.php line 526

#0 /var/www/builds/cms/3.6.0/vendor/yiisoft/yii2/db/ActiveRelationTrait.php(526): yii\base\ErrorHandler->handleError()
yiisoft#1 /var/www/builds/cms/3.6.0/vendor/yiisoft/yii2/db/ActiveRelationTrait.php(246): yii\db\ActiveQuery->filterByModels()
yiisoft#2 /var/www/builds/cms/3.6.0/vendor/yiisoft/yii2/db/ActiveQueryTrait.php(151): yii\db\ActiveQuery->populateRelation()
yiisoft#3 /var/www/builds/cms/3.6.0/vendor/yiisoft/yii2/db/ActiveQuery.php(224): yii\db\ActiveQuery->findWith()
  • Loading branch information
indrig authored Dec 26, 2019
1 parent 573fd5f commit 2fe06b6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion db/ActiveRelationTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,8 @@ private function filterByModels($models)
// single key
$attribute = reset($this->link);
foreach ($models as $model) {
if (($value = $model[$attribute]) !== null) {
if ($model !== null) {
$value = $model[$attribute];
if (is_array($value)) {
$values = array_merge($values, $value);
} elseif ($value instanceof ArrayExpression && $value->getDimension() === 1) {
Expand Down

0 comments on commit 2fe06b6

Please sign in to comment.