diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index d4d245a4d3..3162d02cae 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -4,6 +4,7 @@ Yii Framework 2 Change Log 2.0.46 under development ------------------------ +- Bug #19349: Fix PHP 8.1 error when attribute and label of `yii\grid\DataColumn` are empty (githubjeka) - Bug #19243: Handle `finfo_open` for tar.xz as `application/octet-stream` on PHP 8.1 (longthanhtran) - Bug #19235: Fix return type compatibility of `yii\web\SessionIterator` class methods for PHP 8.1 (virtual-designer) - Bug #19256: Pass missed `$view` to user's callback in `yii\validators\InlineValidator::clientValidateAttribute()` (WinterSilence) diff --git a/framework/grid/DataColumn.php b/framework/grid/DataColumn.php index 8554abd3f8..98d70bd7c8 100644 --- a/framework/grid/DataColumn.php +++ b/framework/grid/DataColumn.php @@ -167,7 +167,9 @@ class DataColumn extends Column $provider = $this->grid->dataProvider; if ($this->label === null) { - if ($provider instanceof ActiveDataProvider && $provider->query instanceof ActiveQueryInterface) { + if ($this->attribute === null) { + $label = ''; + } elseif ($provider instanceof ActiveDataProvider && $provider->query instanceof ActiveQueryInterface) { /* @var $modelClass Model */ $modelClass = $provider->query->modelClass; $model = $modelClass::instance();