Describe the current, buggy behavior
When installing a WordPress core language using wp core language install [...] with WP CLI nightly release (2.5.0-alpha-1a19028), a PHP notice is emitted:
In FileCache.php line 325:
Trying to access array offset on value of type null
Describe how other contributors can replicate this bug
- PHP
7.4.16
- WP CLI
2.5.0-x
Install a WordPress core language that isn't already installed.
Let us know what environment you are running this on
OS: Linux 5.8.0-50-generic wp-cli/language-command#56-Ubuntu SMP Mon Apr 12 17:18:36 UTC 2021 x86_64
Shell: /bin/bash
PHP binary: /usr/bin/php7.4
PHP version: 7.4.16
php.ini used: /etc/php/7.4/cli/php.ini
MySQL binary: /usr/bin/mysql
MySQL version: mysql Ver 15.1 Distrib 10.5.8-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2
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 phar path: /srv/www/example.com/releases/20210422164903
WP-CLI packages dir:
WP-CLI global config:
WP-CLI project config: /srv/www/example.com/releases/20210422164903/wp-cli.yml
WP-CLI version: 2.5.0-alpha-1a19028
** Related **
Apparently the notice above isn't always logged (there is an unrelated issue that causes PHP infos/warnings to be treated as fatal errors that break execution). However, when the notice is not logged, the following warning is logged instead:
Warning: Failed to create directory '/home/web/.wp-cli/cache/': mkdir(): Permission denied.
Ensuring the right permissions (/ownership) of the directory fixed the notice. However, this would be only a workaround for this issue because the variable is used as an array in situations where the variable is actually null, like in this case where mkdir in WP CLI failed.
Describe the current, buggy behavior
When installing a WordPress core language using
wp core language install [...]with WP CLI nightly release (2.5.0-alpha-1a19028), a PHP notice is emitted:Describe how other contributors can replicate this bug
7.4.162.5.0-xInstall a WordPress core language that isn't already installed.
Let us know what environment you are running this on
** Related **
Apparently the notice above isn't always logged (there is an unrelated issue that causes PHP infos/warnings to be treated as fatal errors that break execution). However, when the notice is not logged, the following warning is logged instead:
Ensuring the right permissions (/ownership) of the directory fixed the notice. However, this would be only a workaround for this issue because the variable is used as an array in situations where the variable is actually null, like in this case where
mkdirin WP CLI failed.