I’ve upgraded php from 8.3 to PHP8.4.1_1 (via Homebrew on mac OS X intel), then I started to have a lot of warnings when using PECL/PEAR.
#pecl uninstall grpc protobuf
Deprecated: Constant E_STRICT is deprecated in /usr/local/Cellar/php/8.4.1_1/share/pear/pearcmd.php on line 441 PHP
Deprecated: Constant E_STRICT is deprecated in /usr/local/Cellar/php/8.4.1_1/share/pear/pearcmd.php on line 441
Apparently, since PHP 8.4, the E_STRICT
keyword is deprecated from the PHP language, unfortunately, PEAR code is not up to date and still use this E_STRICT keyword.
I’ve also forced update pear to be sure to have the very last version of pear, without any effect on this issue.
curl -O https://pear.php.net/go-pear.phar
sudo php -d detect_unicode=0 go-pear.phar
2
Answers
I've edited the pearcmd.php file to remove the use of this keyword :
sudo vi /usr/local/Cellar/php/8.4.1_1/share/pear/pearcmd.php
Here is the function with the comments (#) so that you can see the two parts that I've edited:
Dirty fix, but it's really unusable in the current state.
Deprecations are not something you, or anyone else, needs to fix Right Now. They are indications that in the future, an error will happen here.
At the moment, it is likely there will be a PHP 8.5 before PHP 9.0, so you have two years before these deprecations become errors.
If you see deprecations in your own code, you should make time over the next couple of years to modernise it.
If you see deprecations in other people’s code, you have two options:
In this case, I believe the repository you could contribute a fix to is here: https://github.com/pear/pear-core
However, note that PEAR and PECL are very old code bases, and it’s possible they will be replaced completely before PHP 9.0. Most PEAR packages can already be installed via Composer and a replacement for PECL is under development called PIE.