Admin context crashes because of admin.php file formatting
Bug Report
- Yes, I reviewed the contribution guidelines.
- Yes, more specifically, I reviewed the guidelines on how to write clear bug reports.
Describe the current, buggy behavior
Using the --context=admin flag causes WP CLI to error out. It appears to be happening with PHP v8.2 and not PHP v8.0. The error message is:
Warning: require_once(phar://*redacted*/wp/vendor/wp-cli/wp-cli/php/WP_CLI/wp-load.php): Failed to open stream: phar error: "vendor/wp-cli/wp-cli/php/WP_CLI/wp-load.php" is not a file in phar "*redacted*/wp" in phar://*redacted*/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Context/Admin.php(126) : eval()'d code on line 33 Fatal error: Uncaught Error: Failed opening required 'phar://*redacted*/wp/vendor/wp-cli/wp-cli/php/WP_CLI/wp-load.php' (include_path='.:') in phar://*redacted*/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Context/Admin.php(126) : eval()'d code:33 Stack trace: #0 phar://*redacted*/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Context/Admin.php(126): eval() #1 phar://*redacted*/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Context/Admin.php(45): WP_CLI\Context\Admin->load_admin_environment() #2 /var/http/www/public/wp-includes/class-wp-hook.php(305): WP_CLI\Context\Admin->WP_CLI\Context\{closure}() #3 /var/http/www/public/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters() #4 /var/http/www/public/wp-includes/plugin.php(476): WP_Hook->do_action() #5 /var/http/www/public/wp-settings.php(527): do_action() #6 phar://*redacted*/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1349): require('...') #7 phar://*redacted*/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1267): WP_CLI\Runner->load_wordpress() #8 phar://*redacted*/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php(28): WP_CLI\Runner->start() #9 phar://*redacted*/wp/vendor/wp-cli/wp-cli/php/bootstrap.php(83): WP_CLI\Bootstrap\LaunchRunner->process() #10 phar://*redacted*/wp/vendor/wp-cli/wp-cli/php/wp-cli.php(32): WP_CLI\bootstrap() #11 phar://*redacted*/wp/php/boot-phar.php(20): include('...') #12 *redacted*/wp(4): include('...') #13 {main} thrown in phar://*redacted*/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Context/Admin.php(126) : eval()'d code on line 33 Error: There has been a critical error on this website. Please check your site admin email inbox for instructions.Learn more about troubleshooting WordPress. There has been a critical error on this website. Please check your site admin email inbox for instructions.
Describe how other contributors can replicate this bug
- Run
wp --context=admin option get admin_email
Describe what you expect as the correct outcome
Commands run when using the flag should complete successfully.
Let us know what environment you are running this on
OS: Linux 5.15.0-1034-gke #39-Ubuntu SMP Wed May 24 02:42:28 UTC 2023 x86_64
Shell: /bin/bash
PHP binary: /usr/bin/php8.2
PHP version: 8.2.8
php.ini used: /etc/php/8.2/cli/php.ini
MySQL binary: /usr/bin/mysql
MySQL version: mysql Ver 8.0.34-0ubuntu0.22.04.1 for Linux on x86_64 ((Ubuntu))
SQL modes: STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION
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: *redacted*
WP-CLI packages dir:
WP-CLI cache dir: /home/*redacted*/.wp-cli/cache
WP-CLI global config: /home/*redacted*/.wp-cli/config.yml
WP-CLI project config:
WP-CLI version: 2.8.1