Skip to content

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

@slaFFik

Description

@slaFFik

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions