Repository navigation
Description
Note
PSA: If you see warnings when running WP-CLI on PHP 8.4, please update to the latest nightly build first: wp cli update --nightly
This is a general tracking issue for PHP 8.4 compatibility throughout WP-CLI.
Some known issues / blockers:
Broken unit/Behat tests
Unit tests and Behat tests are currently not working on PHP 8.4 due to the bundled Requests v1 triggering an error:
Update: looks like this was fixed in PHP 8.4, so there is no longer any fatal error.
Details
TypeError: curl_setopt(): Argument #3 ($value) must be a valid callback for option CURLOPT_HEADERFUNCTION, no array or string given
/home/runner/work/wp-cli/wp-cli/bundle/rmccue/requests/src/Transport/Curl.php:223
/home/runner/work/wp-cli/wp-cli/bundle/rmccue/requests/src/Requests.php:469
Maybe a good time to migrate to Requests v2?
This is also an issue in v2 though:
TypeError: curl_setopt(): Argument #3 ($value) must be a valid callback for option CURLOPT_HEADERFUNCTION, no array or string given
/tmp/wordpress/wp-includes/Requests/src/Transport/Curl.php:223
/tmp/wordpress/wp-includes/Requests/src/Requests.php:469
So this needs to get fixed in https://github.com/WordPress/Requests
Related:
Deprecation notices in Composer
Some examples:
Deprecation Notice: Composer\Pcre\Preg::replace(): Implicitly marking parameter $count as nullable is deprecated, the explicit nullable type must be used instead in phar:///usr/local/bin/composer/vendor/composer/pcre/src/Preg.php:150
Deprecation Notice: Composer\Pcre\Preg::replaceCallback(): Implicitly marking parameter $count as nullable is deprecated, the explicit nullable type must be used instead in phar:///usr/local/bin/composer/vendor/composer/pcre/src/Preg.php:177
Deprecation Notice: Composer\Pcre\Preg::replaceCallbackArray(): Implicitly marking parameter $count as nullable is deprecated, the explicit nullable type must be used instead in phar:///usr/local/bin/composer/vendor/composer/pcre/src/Preg.php:207
Deprecation Notice: JsonSchema\Constraints\BaseConstraint::__construct(): Implicitly marking parameter $factory as nullable is deprecated, the explicit nullable type must be used instead in phar:///usr/local/bin/composer/vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/BaseConstraint.php:41
Deprecation Notice: JsonSchema\Constraints\BaseConstraint::addError(): Implicitly marking parameter $path as nullable is deprecated, the explicit nullable type must be used instead in phar:///usr/local/bin/composer/vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/BaseConstraint.php:46
Question is whether those are only shown during development or also when using wp package *.
Activity
swissspidy commentedon Jul 11, 2024
So there is a new 5.3.0 release of
justinrainbow/json-schemathat resolves the deprecation notices, but it now requires PHP 7.1 as that's when nullable types were introduced. WP-CLI doesn't use it directly, but it's a dependency ofcomposer/composer.All our tests seem to be passing on PHP 8.4 right now, so that's a good sign 👍
ernilambar commentedon Jul 16, 2024
Notice in
php-cli-tools:swissspidy commentedon Oct 1, 2024
Over at WordPress Trac, the following issue with the testing setup across all WP-CLI repos was raised:
Different fixes are required depending on the PHPUnit versions, so it might not be super trivial to achieve this.
See also:
mrsdizzie commentedon Nov 14, 2024
There are still several places we mark a parameter as nullable and it triggers a warning on PHP 8.4, like:
As mentioned above, the suggested fix requires PHP 7.1 but I believe PHP 5.6 is still the minimum version for wp-cli.
Do we want to settle on a fix for these?
swissspidy commentedon Nov 14, 2024
We actually fixed that one already, but we haven‘t made a new nightly build yet
swissspidy commentedon Nov 26, 2024
The nightly build is finally fixed now 🎉
One obvious deprecation warning that's left is from
mustache/mustachemichaelw85 commentedon Jan 30, 2025
In version 2.11.0 I'm still seeing this error:
swissspidy commentedon Jan 30, 2025
@michaelw85 This is expected. You can update to the latest nightly build in the meantime.
michaelw85 commentedon Jan 30, 2025
Sorry, I just noticed "nightly build" 😅 I thought it was already released. Is there anything I can contribute to help get 8.4 support released?
swissspidy commentedon Jan 30, 2025
I don't think so.
The remaining issue with the mustache library needs some discussion among maintainers/committers first to get consensus.
Otherwise just use the nightly build for now, they are usually very stable :-)
hooch commentedon Feb 10, 2025
Also seeing
swissspidy commentedon Feb 10, 2025
This was already addressed in 887b0bb / the upcoming v2.12.0. Please update to the latest nightly.
yarcowang commentedon Feb 13, 2025
Update:
Disappointed. I wish it could work.
But it seems phar has its own error_reporting settings, external settings does not affect the internal settings.
That must be the design problem (phar) ---- user shoud have the highest priority to define app's actions.
====

I also met this problem... but if you don't mind to add a
auto_prepend_filefile, you can solve it by disable E_DEPRECATED.Normally we don't care about it in usage but turn on it in development as a traditional PHP developer.
(But the phar path
WP_CLI phar path: /Users/yarco/initis changed to a different location. Not sure whether it will take an impact or not.)Or maybe set an alias in bash (would be better if you don't want to affect the global environment):
SirLouen commentedon Apr 25, 2025
I repost here #6085
Judging from the last comments, I can't really see in which point this is currently.
swissspidy commentedon Apr 25, 2025
We‘re planning on forking the mustache library with our existing patches that we already have. A new WP-CLI release is coming out soon.
SirLouen commentedon Apr 25, 2025
Ok I better see the problem now: Last version is from Aug 2024 and it seems that PHP implementation of Mustache is seriously outdated.
So I'm assuming that the main alternative was going for
lightncandyor forking PHP Mustache and sorting the deprecation issues. Do we have a link to the Mustache fork already?swissspidy commentedon Apr 26, 2025
It‘s in preparation.
swissspidy commentedon May 6, 2025
The remaining issue with the Mustache library was fixed by #6090