php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #80781 Error handler that throws ErrorException infinite loop
Submitted: 2021-02-22 00:58 UTC Modified: -
Votes:1
Avg. Score:2.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: dktapps at pmmp dot io Assigned:
Status: Closed Package: Reproducible crash
PHP Version: 7.4.15 OS: Windows 10
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: dktapps at pmmp dot io
New email:
PHP Version: OS:

 

 [2021-02-22 00:58 UTC] dktapps at pmmp dot io
Description:
------------
This bug seems to be specific to 7.4 and upwards: it doesn't reproduce on 7.3 and below, as seen here: https://3v4l.org/EpP2L

The following code results in an infinite loop on Windows and a segmentation fault on Linux.

Test script:
---------------
<?php

declare(strict_types=1);

function handle(int $severity, string $message, string $file, int $line) : bool{
	if((error_reporting() & $severity) !== 0){
		throw new \ErrorException($message, 0, $severity, $file, $line);
	}

	return true; //stfu operator
}

set_error_handler('handle');
function getPlugin(string $plugin) : bool{
	return false;
}
$data = [];
$array = [];
if(isset($array[$data]) or getPlugin($data)){

}


Expected result:
----------------
Something like the following:

Fatal error: Uncaught ErrorException: Illegal offset type in isset or empty in /in/EpP2L:19
Stack trace:
#0 /in/EpP2L(19): handle(2, 'Illegal offset ...', '/in/EpP2L', 19, Array)
#1 {main}
  thrown in /in/EpP2L on line 19

Actual result:
--------------
An infinite loop occurs on Windows.
Judging by the exit code on 3v4l, it appears this script causes a segfault on Unix.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-02-22 08:38 UTC] nikic@php.net
Automatic comment on behalf of nikita.ppv@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=6dd85f83f78fbafc4a90b264e577a31b59323314
Log: Fixed bug #80781
 [2021-02-22 08:38 UTC] nikic@php.net
-Status: Open +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 15:01:30 2024 UTC