Skip to content

Fix repeated error suppression across error types - #24757

Open
kairosci wants to merge 1 commit into
php:masterfrom
kairosci:fix/gh-19509-ignore-repeated-errors
Open

kairosci wants to merge 1 commit into
php:masterfrom
kairosci:fix/gh-19509-ignore-repeated-errors

Conversation

@kairosci

Copy link
Copy Markdown
Contributor

Fixes #19509.

@kairosci
kairosci requested a review from bukka as a code owner October 26, 2026 20:23
@anun333

anun333 commented Oct 29, 2026

Copy link
Copy Markdown

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:

./buildconf --force
./configure --enable-debug --disable-cgi --disable-phpdbg --disable-fileinfo --enable-pcntl --enable-zend-test --enable-fpm --with-curl --enable-mbstring --disable-mbregex
make -j4

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ignore_repeated_errors ini entry does not work

2 participants