PHP 8.4.1 : Constant E_STRICT is deprecated in pearcmd.php on line 441

PHP 8.4.1 : Constant E_STRICT is deprecated in pearcmd.php on line 441

  1. Blog
  2. 15 November 2026
  3. 3 min read

Stefan Bogdanescu

Founder & Senior Architect

PHP 8.4.1 : Constant E_STRICT is deprecated in pearcmd.php on line 441

Upgrading from PHP 8.3 to 8.4.1 on macOS via Homebrew recently introduced a cascade of warnings when interacting with PECL and PEAR. If you are installing extensions like grpc, protobuf, or mongodb, you will likely encounter immediate deprecation notices pointing to /usr/local/Cellar/php/8.4.1_1/share/pear/pearcmd.php on line 441. The error message explicitly states: Deprecated: Constant E_STRICT is deprecated.

This issue stems from a deliberate removal of the E_STRICT constant in PHP 8.4. Historically, E_STRICT was used to trigger warnings for coding standards violations, such as using uninitialized variables or passing incorrect types. However, modern PHP development relies heavily on strict typing enforced via attributes (#[StrictTypes]) and runtime type checks rather than this specific error level constant. The PHP core team deprecated the constant in 8.4 because it serves little purpose in contemporary codebases and creates noise in logs without adding value.

The problem arises because PEAR's internal command-line interface, pearcmd.php, still references this obsolete constant. Even if you force an update to the latest version of PEAR using the standard installer script, the underlying PHP 8.4 runtime rejects the usage of the constant before PEAR can execute its logic. This creates a catch-22 where updating the package manager itself fails due to the runtime environment's stricter standards.

curl -O https://pear.php.net/go-pear.phar
sudo php -d detect_unicode=0 go-pear.phar

Running the standard upgrade command above will not resolve the deprecation warnings because the source code of pearcmd.php within your Homebrew installation remains tied to the deprecated constant. The warning persists regardless of whether you are installing new extensions or uninstalling existing ones like grpc and protobuf.

The most effective resolution involves patching the specific file causing the error directly within your Homebrew installation path. You need to locate pearcmd.php inside your PHP prefix, typically found at /usr/local/Cellar/php/8.4.1_1/share/pear/. Once located, open the file and search for line 441 (or wherever the warning points).

You will likely find a line resembling:

trigger_error("...E_STRICT...", E_USER_DEPRECATED | E_STRICT);

or simply E_STRICT used in an error level definition. To silence these warnings, you must replace the usage of E_STRICT with 0, which effectively disables that specific error flag, or remove the constant entirely if it is not required for the logic flow.

// Before (Line 441 in pearcmd.php)
trigger_error($message, E_USER_NOTICE | E_STRICT); 

// After
trigger_error($message, E_USER_NOTICE);

Alternatively, you can define a local alias if you need to keep the code structure intact temporarily:

define('E_STRICT', 0);

By modifying this specific file, you align PEAR's internal logic with the new PHP 8.4 runtime requirements. This allows commands like pecl install mongodb to proceed without polluting your logs with deprecation notices.

While this patch is a workaround rather than a permanent upstream fix, it is the only viable option until PEAR developers update their codebase for PHP 8.4 compatibility. Developers should be aware that relying on PEAR packages in newer PHP versions may require manual intervention when core constants are deprecated or removed. For production environments, consider managing these dependencies through alternative package managers like composer where possible, as they often offer better support for modern PHP versions and stricter type safety mechanisms.

Our network