climate icon indicating copy to clipboard operation
climate copied to clipboard

[Warning] PHP Deprecated: strlen(): Passing null to parameter #1

Open kekefreedog opened this issue 3 years ago • 1 comments

Hello,

I am using climate with PHP8.1, and I have this log : PHP Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /Users/Toto/Sites/Sandbox/vendor/league/climate/src/TerminalObject/Basic/BasicTerminalObject.php on line 21

To fix this warning message, I just add this $value && strlen($value) in https://github.com/thephpleague/climate/blob/637555fdf6285c8077297f326760d9d8a5112f28/src/TerminalObject/Basic/BasicTerminalObject.php#L21

protected function set($key, $value)
{
    if ($value && strlen($value)) {
        $this->$key = $value;
    }
}

Is it possible to include this fix in the next release ?

Best

kekefreedog avatar Feb 14 '22 14:02 kekefreedog

Same problem here : Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /Users/toto/Sites/LuckyPHP/vendor/league/climate/src

https://github.com/thephpleague/climate/blob/637555fdf6285c8077297f326760d9d8a5112f28/src/TerminalObject/Dynamic/Progress.php#L216

Fix :

// If this line has a label then set that this progress bar has a label line
if ($label && strlen($label) > 0) {
    $this->has_label_line = true;
}

kekefreedog avatar Feb 14 '22 14:02 kekefreedog