1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 08:12:21 +01:00

Merge branch 'PHP-8.1'

* PHP-8.1:
  Fix bug #81591: ignore_repeated_errors broken
This commit is contained in:
Nikita Popov
2021-11-04 16:25:24 +01:00
3 changed files with 50 additions and 1 deletions

View File

@@ -0,0 +1,25 @@
--TEST--
Test ignore_repeated_errors ini setting
--INI--
ignore_repeated_errors=1
--FILE--
<?php
// Not a repeated error due to different variables names.
$u1 + $u2;
// Repeated error.
$u + $u;
// Not a repeated error, because the line is different.
$u + 1;
?>
--EXPECTF--
Warning: Undefined variable $u1 in %s on line %d
Warning: Undefined variable $u2 in %s on line %d
Warning: Undefined variable $u in %s on line %d
Warning: Undefined variable $u in %s on line %d

View File

@@ -0,0 +1,24 @@
--TEST--
Test ignore_repeated_source ini setting
--INI--
ignore_repeated_errors=1
ignore_repeated_source=1
--FILE--
<?php
// Not a repeated error due to different variables names.
$u1 + $u2;
// Repeated error.
$u + $u;
// Also a repeated error, because we're ignoring the different source.
$u + 1;
?>
--EXPECTF--
Warning: Undefined variable $u1 in %s on line %d
Warning: Undefined variable $u2 in %s on line %d
Warning: Undefined variable $u in %s on line %d

View File

@@ -1212,7 +1212,7 @@ static ZEND_COLD void php_error_cb(int orig_type, zend_string *error_filename, c
if (PG(ignore_repeated_errors) && PG(last_error_message)) {
/* no check for PG(last_error_file) is needed since it cannot
* be NULL if PG(last_error_message) is not NULL */
if (zend_string_equals(PG(last_error_message), message)
if (!zend_string_equals(PG(last_error_message), message)
|| (!PG(ignore_repeated_source)
&& ((PG(last_error_lineno) != (int)error_lineno)
|| !zend_string_equals(PG(last_error_file), error_filename)))) {