You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Fix repeated error suppression across error types - #24757
Quoted below: written with Claude, an LLM, as CONTRIBUTING.md asks us to mark. The builds and test runs behind it are on my machine; the commands to repeat them are under the fold.
Tested on today's master (17cfa007d5d) with this applied, debug builds, display_errors=1, counting messages shown:
master
this PR
the issue's loop, E_ALL: the warning / the deprecation after it
10 / 10
1 / 1
the same, E_ALL & ~E_DEPRECATED
10
1
ignore_repeated_errors=0 (control)
10
10
one message from two lines, ignore_repeated_source=0 / 1
6 / 1
6 / 1
error_get_last() after the loop
the deprecation
the deprecation
a user error handler, calls
20
20
Zend/tests and tests
6,448 passed
6,449 passed, 0 failed
One design note: this keeps a last message per error type, so a repeat is also suppressed when other displayed errors come in between (the deprecation above drops to one too). The issue's report shows only warnings, so its deprecations were filtered out by error_reporting; tracking just the last error that passed error_reporting, as suggested on the issue, should cover that case without widening what counts as repeated. Which of the two is wanted is a call for the reviewer.
How this was tested
Linux x86_64, gcc 13.3, debug builds of origin/master and of it with this PR's commit cherry-picked:
Each row: sapi/cli/php -n -d display_errors=1 -d html_errors=0 -d ignore_repeated_errors=1 -d error_reporting=… -r 'for ($i = 0; $i < 10; $i++) { trim($at); }', counting "Undefined variable" and "Deprecated" lines; the source rows use echo $a; on two lines, three times. Suites: TEST_PHP_EXECUTABLE=$PWD/sapi/cli/php sapi/cli/php run-tests.php -n -q -j4 Zend/tests tests.
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
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.
Fixes #19509.