Skip to content
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

Sage 10 error handler: WP CLI warning breaks WP CLI #2680

Closed
4 tasks done
strarsis opened this issue Apr 22, 2021 · 1 comment
Closed
4 tasks done

Sage 10 error handler: WP CLI warning breaks WP CLI #2680

strarsis opened this issue Apr 22, 2021 · 1 comment

Comments

@strarsis
Copy link
Contributor

strarsis commented Apr 22, 2021

Description

Some PHP warnings may be emitted by current WP CLI stable release (2.4.0) (that should be fixed with nightly (2.5.0)) when installing new languages. These warnings wouldn't prevent WP CLI from installing these languages, but Sage 10 error handler turns these warnings into fatal errors that break the WP CLI command at that point.

PHP warning (not treated as fatal error, WP CLI execution can proceed):

PHP Warning:  Declaration of WP_CLI\LanguagePackUpgrader::download_package($package, $check_signatures = false) should be compatible with WP_Upgrader::download_package($package, $check_signatures = false, $hook_extra = Array) in phar:///usr/bin/wp/vendor/wp-cli/language-command/src/WP_CLI/LanguagePackUpgrader.php on line 51
Warning: Declaration of WP_CLI\LanguagePackUpgrader::download_package($package, $check_signatures = false) should be compatible with WP_Upgrader::download_package($package, $check_signatures = false, $hook_extra = Array) in phar:///usr/bin/wp/vendor/wp-cli/language-command/src/WP_CLI/LanguagePackUpgrader.php on line 51

PHP warning turned into a PHP fatal error (Sage 10 theme error handler):

In LanguagePackUpgrader.php line 51:
                                                                                                                                    
  Declaration of WP_CLI\LanguagePackUpgrader::download_package($package, $check_signatures = false) should be compatible with WP_U  
  pgrader::download_package($package, $check_signatures = false, $hook_extra = Array)                                               

Steps to reproduce

  1. Ensure WP CLI stable release 2.4.0 is installed on the server (a workstation/client WP CLI would just passthrough the commands).
  2. Ensure the site uses a Sage 10-based theme.
  3. Invoke WP CLI (server-side version!) to install a WordPress core language. Notice that a fatal error is logged, WP CLI execution aborted and the core language wasn't installed.

Also note that updating WP CLI to nightly release (2.5.0) is not sufficient as other PHP notices/warnings are emitted (e.g. In FileCache.php line 325: Trying to access array offset on value of type null), which will all break WP CLI execution.

Expected behavior:
PHP warnings and notices should not be escalated to PHP fatal errors, WP CLI should be able to finish execution.

Actual behavior:
PHP warnings and notices are escalated to PHP fatal errors, WP CLI is not able to finish execution.

Reproduces how often:
As long as the Sage 10 theme is used by the site or WP CLI less or equal the stable release (2.4.0) is used.

Versions

### 10.0.0-beta.1: TBA
[...]

Related issues

Related discussions

https://discourse.roots.io/t/workaround-php-7-4-x-fix-cli-deprecation-warning/18566/3
(how to enforce a specific WP CLI version on a Trellis system in order to fix a deployment-blocking issue)

@schlessera
Copy link

schlessera commented May 5, 2021

Also note that updating WP CLI to nightly release (2.5.0) is not sufficient as other PHP notices/warnings are emitted (e.g. In FileCache.php line 325: Trying to access array offset on value of type null), which will all break WP CLI execution.

This was fixed via wp-cli/wp-cli#5520 and will be included in the next nightly.

@Log1x Log1x closed this as completed May 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants