Repository navigation
fix: avoid the E_STRICT deprecation on PHP 8.4+ - #189
Open
adriandmitroca wants to merge 1 commit into
Open
adriandmitroca wants to merge 1 commit into
adriandmitroca wants to merge 1 commit into
Conversation
PHP 8.4 deprecated the E_STRICT constant, so reading it in buildIncludedErrno() and in the logging-level options raises an E_DEPRECATED notice on every request. Use its value (2048) through Plugin::E_STRICT instead: the bitmask and saved settings are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On PHP 8.4 and later, every request on a site with the plugin active logs two notices:
Plugin::buildIncludedErrno()and the "Logging Level" options inSettingsread theE_STRICTconstant. PHP 8.4 deprecated the constant itself, so just reading it raisesE_DEPRECATED. WithWP_DEBUGon, this adds two log lines per request; on busy sites it becomes the largest source of PHP log volume.Fix
Add
Plugin::E_STRICT = 2048(the value ofE_STRICT) and use it in both places, without reading the global constant.buildIncludedErrno()is identical on every supported PHP version (E_STRICT === 2048).2048keep working, and the option keeps its label.E_STRICTerrors since 8.0, so including the bit has no effect beyond backward compatibility.Test
php -lon both changed files.🤖 Generated with Claude Code