wp-cli / php-cli-tools

A collection of tools to help with PHP command line utilities
MIT License
676 stars 118 forks source link

Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in Ascii.php::141 #178

Closed slaFFik closed 1 month ago

slaFFik commented 1 month ago

Bug Report

Describe the current, buggy behavior

PHP Deprecated notice:

Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in phar:///opt/homebrew/Cellar/wp-cli/2.11.0/bin/wp/vendor/wp-cli/php-cli-tools/lib/cli/table/Ascii.php on line 141

Describe how other contributors can replicate this bug

Describe what you would expect as the correct outcome

No deprecations.

Let us know what environment you are running this on

OS:     Darwin 23.6.0 Darwin Kernel Version 23.6.0: Wed Jul 31 20:49:39 PDT 2024; root:xnu-10063.141.1.700.5~1/RELEASE_ARM64_T6000 arm64
Shell:  /bin/zsh
PHP binary:     /opt/homebrew/Cellar/php@8.2/8.2.24_1/bin/php
PHP version:    8.2.24
php.ini used:   /opt/homebrew/etc/php/8.2/php.ini
MySQL binary:   
MySQL version:  
SQL modes:      
WP-CLI root dir:        phar://wp-cli.phar/vendor/wp-cli/wp-cli
WP-CLI vendor dir:      phar://wp-cli.phar/vendor
WP-CLI packages dir:    /Users/slaffik/.wp-cli/packages/
WP-CLI cache dir:       /Users/slaffik/.wp-cli/cache
WP-CLI global config:   
WP-CLI project config:  
WP-CLI version: 2.11.0

Provide a possible solution

In this code

$value = $value ?: '';
$value = str_replace( array( "\r\n", "\n" ), ' ', $value );

cast the value to string.

swissspidy commented 1 month ago

Oh, this was actually already fixed in #174.