Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
2 tasks done
slaFFik opened this issue Oct 17, 2024 · 1 comment

Comments

@slaFFik
Copy link
Contributor

slaFFik commented Oct 17, 2024

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

  • make sure you are on PHP 8.2
  • run wp package browse command

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
Copy link
Member

Oh, this was actually already fixed in #174.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants