Make WordPress Core

Opened 8 months ago

#60077 assigned defect (bug)

Class UnexpectedValueException not found

Reported by: vikram6's profile vikram6 Owned by:
Milestone: Awaiting Review Priority: normal
Severity: critical Version: 6.4.2
Component: Database Keywords:
Focuses: Cc:

Description

I'm seeing the following error when running certain wp cli commands -

PHP Fatal error:  Uncaught Error: Class "WpOrg\Requests\UnexpectedValueException" not found in wp-includes/Requests/src/Iri.php:726

I believe this bug was introduced recently in this commit - https://core.trac.wordpress.org/changeset/56835. UnexpectedValueException is missing the backslash \ and hence PHP is trying to find it in the WpOrg\Requests namespace instead of the global namespace. The lines of code that are referencing UnexpectedValueException should be updated to the following -

throw new \UnexpectedValueException();

Full stack trace -

PHP Fatal error:  Uncaught Error: Class "WpOrg\Requests\UnexpectedValueException" not found in wp-includes/Requests/src/Iri.php:726
Stack trace:
#0 [internal function]: WpOrg\Requests\Iri->__wakeup()
#1 phar:///usr/share/wp-cli.phar/vendor/wp-cli/search-replace-command/src/WP_CLI/SearchReplacer.php(86): unserialize()
#2 phar:///usr/share/wp-cli.phar/vendor/wp-cli/search-replace-command/src/WP_CLI/SearchReplacer.php(57): WP_CLI\SearchReplacer->run_recursively()
#3 phar:///usr/share/wp-cli.phar/vendor/wp-cli/search-replace-command/src/Search_Replace_Command.php(580): WP_CLI\SearchReplacer->run()
#4 phar:///usr/share/wp-cli.phar/vendor/wp-cli/search-replace-command/src/Search_Replace_Command.php(400): Search_Replace_Command->php_handle_col()
#5 [internal function]: Search_Replace_Command->__invoke()
#6 phar:///usr/share/wp-cli.phar/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php(100): call_user_func()
#7 [internal function]: WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher\{closure}()
#8 phar:///usr/share/wp-cli.phar/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/Subcommand.php(491): call_user_func()
#9 phar:///usr/share/wp-cli.phar/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(417): WP_CLI\Dispatcher\Subcommand->invoke()
#10 phar:///usr/share/wp-cli.phar/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(440): WP_CLI\Runner->run_command()
#11 phar:///usr/share/wp-cli.phar/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1237): WP_CLI\Runner->run_command_and_exit()
#12 phar:///usr/share/wp-cli.phar/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php(28): WP_CLI\Runner->start()
#13 phar:///usr/share/wp-cli.phar/vendor/wp-cli/wp-cli/php/bootstrap.php(78): WP_CLI\Bootstrap\LaunchRunner->process()
#14 phar:///usr/share/wp-cli.phar/vendor/wp-cli/wp-cli/php/wp-cli.php(27): WP_CLI\bootstrap()
#15 phar:///usr/share/wp-cli.phar/php/boot-phar.php(11): include('...')
#16 /usr/share/wp-cli.phar(4): include('...')
#17 {main}

More details -

  • WordPress version - 6.4.2
  • WP CLI command - wp search-replace foo bar --regex --skip-plugins --skip-themes
  • The database needs to have a certain format of serialized data to reproduce this but I'm not exactly sure what that format is.

Change History (0)

Note: See TracTickets for help on using tickets.