php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #81602 Unexpected behaviour of ignore_repeated_errors php configuration
Submitted: 2021-11-09 08:25 UTC Modified: 2021-11-09 09:41 UTC
From: farajayh at gmail dot com Assigned:
Status: Duplicate Package: PHP options/info functions
PHP Version: 8.0.12 OS: Linux alma-linux/Windows 10
Private report: No CVE-ID: None
 [2021-11-09 08:25 UTC] farajayh at gmail dot com
Description:
------------
When "display_errors" is set to "On", only the first error in a script is reported, even if there are multiple errors of different types, in different lines across the script, and error_reporting is set to E_ALL.

However, if ignore_repeated_errors is set to "Off", all errors are displayed as they should. The ignore_repeated_errors flag prevents same error of same type, in the same line from being displayed more than once, according to the documentation. But in this case, it prevents all errors, asides the first error, from being displayed.

PS: When ignore_repeated_errors is set to "On", only the first error is logged in my log file, even if the errors are of different types and occurs in different lines across the script.

Test script:
---------------
<?php
    ini_set("display_errors", "On"); error_reporting(E_ALL);
    ini_set("ignore_repeated_errors", "On");

    echo $undefined_variable; //This should display a notice report

    include("non-existing-file"); //This should display a warning report

    //This should display a fatal error before script termination
    require_once("non-existing-file");

Expected result:
----------------
Warning: Undefined variable $undefined_variable in /var/www/html/mysite/test.php on line 5

Warning: include(non-existing-file): Failed to open stream: No such file or directory in /var/www/html/mysite/test.php on line 7

Warning: include(): Failed opening 'non-existing-file' for inclusion (include_path='.:/usr/share/pear:/usr/share/php:/usr/share/pear:/usr/share/php') in /var/www/html/mysite/test.php on line 7

Warning: require_once(non-existing-file): Failed to open stream: No such file or directory in /var/www/html/mysite/test.php on line 10

Fatal error: Uncaught Error: Failed opening required 'non-existing-file' (include_path='.:/usr/share/pear:/usr/share/php:/usr/share/pear:/usr/share/php') in /var/www/html/mysite/test.php:10 Stack trace: #0 {main} thrown in /var/www/html/mysite/test.php on line 10

Actual result:
--------------
Warning: Undefined variable $undefined_variable in /var/www/html/mysite/test.php on line 5

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-11-09 08:30 UTC] nikic@php.net
Duplicate of #81591, which will be fixed in the next PHP 8.0 release.
 [2021-11-09 09:41 UTC] nikic@php.net
-Status: Open +Status: Duplicate
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 07:01:29 2024 UTC