-
Notifications
You must be signed in to change notification settings - Fork 998
Closed
Labels
Milestone
Description
Bug Report
I'm using wp-cli v2.7.1 in Local. When I have a repo using PHP8.1.9, whenever I start or stop the site. I get a PHP Deprecated warning as follows.
[21-Feb-2023 18:00:11 UTC] PHP Deprecated: Return type of WP_CLI\Iterators\Transform::current() should either be compatible with IteratorIterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///Applications/Local.app/Contents/Resources/extraResources/bin/wp-cli/wp-cli.phar/vendor/wp-cli/wp-cli/php/WP_CLI/Iterators/Transform.php on line 18
[21-Feb-2023 18:00:11 UTC] PHP Stack trace:
[21-Feb-2023 18:00:11 UTC] PHP 1. {main}() /Applications/Local.app/Contents/Resources/extraResources/bin/wp-cli/wp-cli.phar:0
[21-Feb-2023 18:00:11 UTC] PHP 2. include() /Applications/Local.app/Contents/Resources/extraResources/bin/wp-cli/wp-cli.phar:4
[21-Feb-2023 18:00:11 UTC] PHP 3. include() phar:///Applications/Local.app/Contents/Resources/extraResources/bin/wp-cli/wp-cli.phar/php/boot-phar.php:11
[21-Feb-2023 18:00:11 UTC] PHP 4. WP_CLI\bootstrap() phar:///Applications/Local.app/Contents/Resources/extraResources/bin/wp-cli/wp-cli.phar/vendor/wp-cli/wp-cli/php/wp-cli.php:32
[21-Feb-2023 18:00:11 UTC] PHP 5. WP_CLI\Bootstrap\LaunchRunner->process($state = class WP_CLI\Bootstrap\BootstrapState { private $state = ['context_manager' => class WP_CLI\ContextManager { ... }] }) phar:///Applications/Local.app/Contents/Resources/extraResources/bin/wp-cli/wp-cli.phar/vendor/wp-cli/wp-cli/php/bootstrap.php:78
[21-Feb-2023 18:00:11 UTC] PHP 6. WP_CLI\Runner->start() phar:///Applications/Local.app/Contents/Resources/extraResources/bin/wp-cli/wp-cli.phar/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php:28
[21-Feb-2023 18:00:11 UTC] PHP 7. WP_CLI\Runner->run_command_and_exit($help_exit_warning = *uninitialized*) phar:///Applications/Local.app/Contents/Resources/extraResources/bin/wp-cli/wp-cli.phar/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php:1256
[21-Feb-2023 18:00:11 UTC] PHP 8. WP_CLI\Runner->run_command($args = [0 => 'user', 1 => 'list'], $assoc_args = ['role' => 'administrator', 'format' => 'json'], $options = *uninitialized*) phar:///Applications/Local.app/Contents/Resources/extraResources/bin/wp-cli/wp-cli.phar/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php:442
[21-Feb-2023 18:00:11 UTC] PHP 9. WP_CLI\Dispatcher\Subcommand->invoke($args = [], $assoc_args = ['role' => 'administrator', 'format' => 'json'], $extra_args = []) phar:///Applications/Local.app/Contents/Resources/extraResources/bin/wp-cli/wp-cli.phar/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php:419
[21-Feb-2023 18:00:11 UTC] PHP 10. call_user_func:{phar:///Applications/Local.app/Contents/Resources/extraResources/bin/wp-cli/wp-cli.phar/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/Subcommand.php:491}($callback = class Closure { virtual $closure = "$this->WP_CLI\Dispatcher\{closure}", public $static = ['callable' => [...]]; public $parameter = ['$args' => '<required>', '$assoc_args' => '<required>'] }, ...$args = variadic(['role' => 'administrator', 'format' => 'json'])) phar:///Applications/Local.app/Contents/Resources/extraResources/bin/wp-cli/wp-cli.phar/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/Subcommand.php:491
[21-Feb-2023 18:00:11 UTC] PHP 11. WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher\{closure:phar:///Applications/Local.app/Contents/Resources/extraResources/bin/wp-cli/wp-cli.phar/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php:97-104}($args = [], $assoc_args = ['role' => 'administrator', 'format' => 'json']) phar:///Applications/Local.app/Contents/Resources/extraResources/bin/wp-cli/wp-cli.phar/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/Subcommand.php:491
[21-Feb-2023 18:00:11 UTC] PHP 12. call_user_func:{phar:///Applications/Local.app/Contents/Resources/extraResources/bin/wp-cli/wp-cli.phar/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php:100}($callback = [0 => class User_Command { protected $obj_type = 'user'; protected $obj_id_key = 'ID'; protected $obj_fields = [...]; private $cap_fields = [...]; public $fetcher = class WP_CLI\Fetchers\User { ... }; public $sitefetcher = class WP_CLI\Fetchers\Site { ... } }, 1 => 'list_'], ...$args = variadic(['role' => 'administrator', 'format' => 'json'])) phar:///Applications/Local.app/Contents/Resources/extraResources/bin/wp-cli/wp-cli.phar/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php:100
[21-Feb-2023 18:00:11 UTC] PHP 13. User_Command->list_($args = [], $assoc_args = ['role' => 'administrator', 'format' => 'json']) phar:///Applications/Local.app/Contents/Resources/extraResources/bin/wp-cli/wp-cli.phar/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php:100
[21-Feb-2023 18:00:11 UTC] PHP 14. WP_CLI\Utils\iterator_map($it = [1 => class WP_User { public $data = class stdClass { ... }; public $ID = 1; public $caps = [...]; public $cap_key = 'wp_capabilities'; public $roles = [...]; public $allcaps = [...]; public $filter = NULL; private $site_id = 1 }], $fn = class Closure { virtual $closure = "$this->{closure}", public $this = class User_Command { protected $obj_type = 'user'; protected $obj_id_key = 'ID'; protected $obj_fields = [...]; private $cap_fields = [...]; public $fetcher = class WP_CLI\Fetchers\User { ... }; public $sitefetcher = class WP_CLI\Fetchers\Site { ... } }; public $parameter = ['$user' => '<required>'] }) phar:///Applications/Local.app/Contents/Resources/extraResources/bin/wp-cli/wp-cli.phar/vendor/wp-cli/entity-command/src/User_Command.php:192
[21-Feb-2023 18:00:11 UTC] PHP 15. Composer\Autoload\ClassLoader->loadClass($class = 'WP_CLI\\Iterators\\Transform') phar:///Applications/Local.app/Contents/Resources/extraResources/bin/wp-cli/wp-cli.phar/vendor/wp-cli/wp-cli/php/utils.php:149
[21-Feb-2023 18:00:11 UTC] PHP 16. Composer\Autoload\includeFile($file = 'phar:///Applications/Local.app/Contents/Resources/extraResources/bin/wp-cli/wp-cli.phar/vendor/composer/../wp-cli/wp-cli/php/WP_CLI/Iterators/Transform.php') phar:///Applications/Local.app/Contents/Resources/extraResources/bin/wp-cli/wp-cli.phar/vendor/composer/ClassLoader.php:428
The answer seems to be in the first line above. A return type of mixed
to the function or add #[\ReturnTypeWillChange]
to suppress.
https://github.com/wp-cli/wp-cli/blob/main/php/WP_CLI/Iterators/Transform.php