Fix PHP 8.1 Empty header DataColumn (#19350)

* Fix PHP 8.1 Empty header DataColumn

#19349

* Update CHANGELOG.md

* Update CHANGELOG.md

Co-authored-by: Bizley <pawel@positive.codes>
This commit is contained in:
octicon-git-branch(16/)
octicon-tag(16/)
Evgeniy Tkachenko
2022-04-13 18:58:28 +03:00
committed by GitHub
gitea-unlock(16/)
parent 0741c4cab0
commit ad1fd84f39
octicon-diff(16/tw-mr-1) 2 changed files with 4 additions and 1 deletions

1
framework/CHANGELOG.md
View File

@@ -4,6 +4,7 @@ Yii Framework 2 Change Log
2.0.46 under development 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 #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 #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) - Bug #19256: Pass missed `$view` to user's callback in `yii\validators\InlineValidator::clientValidateAttribute()` (WinterSilence)

4
framework/grid/DataColumn.php
View File

@@ -167,7 +167,9 @@ class DataColumn extends Column
$provider = $this->grid->dataProvider; $provider = $this->grid->dataProvider;
if ($this->label === null) { 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 */ /* @var $modelClass Model */
$modelClass = $provider->query->modelClass; $modelClass = $provider->query->modelClass;
$model = $modelClass::instance(); $model = $modelClass::instance();