kartik-v / yii2-export

A library to export server/db data in various formats (e.g. excel, html, pdf, csv etc.)
http://demos.krajee.com/export
Other
165 stars 126 forks source link

PHP Deprecated Warning - trim(): Passing null to parameter #1 ($string) of type string is deprecated #374

Open Alexchep opened 9 months ago

Alexchep commented 9 months ago

I've installed PHP 8.2 and got Deprecated warning in kartik-v/yii2-export/src/ExportMenu.php on line #1303 (version 1.4.3 - latest)

image

I think we need to check $col->header before trim() and define empty string at least maybe if it's NULL. Here:

if ($col->header !== null || ($col->label === null && $col->attribute === null)) { return trim($col->header) !== '' ? $col->header : $col->grid->emptyCell; }

I know it's warning, not error. But it would nice if you can fix it with time. Thanks!