Bug Report
Describe the current, buggy behavior
When running the command wp doctor check cache-flush the result is a PHP fatal error with a missing WP_CLI\Path class not found.
Example error:
Fatal error: Uncaught Error: Class "WP_CLI\Path" not found in /usr/local/wp-cli/packages/vendor/wp-cli/doctor-command/src/Check/Cache_Flush.php:43
Stack trace:
#0 [internal function]: WP_CLI\Doctor\Check\Cache_Flush->WP_CLI\Doctor\Check\{closure}(Object(SplFileInfo))
#1 /usr/local/wp-cli/packages/vendor/wp-cli/doctor-command/src/Check/Cache_Flush.php(41): array_map(Object(Closure), Array)
#2 /usr/local/wp-cli/packages/vendor/wp-cli/doctor-command/src/Command.php(213): WP_CLI\Doctor\Check\Cache_Flush->run()
#3 [internal function]: WP_CLI\Doctor\Command->check(Array, Array)
#4 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php(100): call_user_func(Array, Array, Array)
#5 [internal function]: WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher\{closure}(Array, Array)
#6 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/Subcommand.php(497): call_user_func(Object(Closure), Array, Array)
#7 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(470): WP_CLI\Dispatcher\Subcommand->invoke(Array, Array, Array)
#8 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(493): WP_CLI\Runner->run_command(Array, Array)
#9 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(136): WP_CLI\Runner->run_command_and_exit()
#10 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1228): WP_CLI\Runner->do_early_invoke('before_wp_load')
#11 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php(28): WP_CLI\Runner->start()
#12 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/bootstrap.php(84): WP_CLI\Bootstrap\LaunchRunner->process(Object(WP_CLI\Bootstrap\BootstrapState))
#13 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/wp-cli.php(35): WP_CLI\bootstrap()
#14 phar:///usr/local/bin/wp/php/boot-phar.php(20): include('phar:///usr/loc...')
#15 /usr/local/bin/wp(4): include('phar:///usr/loc...')
#16 {main}
thrown in /usr/local/wp-cli/packages/vendor/wp-cli/doctor-command/src/Check/Cache_Flush.php on line 43
Describe how other contributors can replicate this bug
- Run
wp doctor check cache-flush
- See PHP fatal error
- Run other checks
- No PHP fatal error shown (cache-flush check appears to be the only one using the
WP_CLI\Path class).
- Run
wp cli update and see no PHP fatal error about the WP_CLI\Path class, notice that it makes it past the usage of the class method
Describe what you would expect as the correct outcome
Path class should exist and be loaded like the other WP_CLI namespace classes.
Let us know what environment you are running this on
OS: Linux 6.12.0-211.22.1.el10_2.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Jun 11 08:11:48 EDT 2026 x86_64
Shell:
PHP binary: /usr/local/bin/php
PHP version: 8.2.30
php.ini used: /usr/local/etc/php/php.ini
MySQL binary: /usr/bin/mysql
MySQL version: mysql Ver 8.4.8-8 for Linux on x86_64 (Percona Server (GPL), Release '8', Revision '1c288264')
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: phar:///usr/local/bin/wp
WP-CLI packages dir: /usr/local/wp-cli/packages/
WP-CLI cache dir: /root/.wp-cli/cache
WP-CLI global config:
WP-CLI project config:
WP-CLI version: 2.12.0
Provide additional context/Screenshots
Here are some things I noticed:
WP_CLI\Path is only actively called by the cache flush check, the only other place in this repo that references it seems to be uncalled by anything else
WP_CLI\Path can be used just fine when calling wp cli update which seems to prove the class can be autoloaded and used by the primary WP-CLI phar
Bug Report
Describe the current, buggy behavior
When running the command
wp doctor check cache-flushthe result is a PHP fatal error with a missingWP_CLI\Pathclass not found.Example error:
Describe how other contributors can replicate this bug
wp doctor check cache-flushWP_CLI\Pathclass).wp cli updateand see no PHP fatal error about theWP_CLI\Pathclass, notice that it makes it past the usage of the class methodDescribe what you would expect as the correct outcome
Path class should exist and be loaded like the other WP_CLI namespace classes.
Let us know what environment you are running this on
Provide additional context/Screenshots
Here are some things I noticed:
WP_CLI\Pathis only actively called by the cache flush check, the only other place in this repo that references it seems to be uncalled by anything elseWP_CLI\Pathcan be used just fine when callingwp cli updatewhich seems to prove the class can be autoloaded and used by the primary WP-CLI phar