Bug #80781 [NEW]: Error handler that throws ErrorException infinite loop
| From: | dktapps at pmmp dot io | Date: | Mon, 22 Feb 2021 00:58:13 +0000 |
| Subject: | Bug #80781 [NEW]: Error handler that throws ErrorException infinite loop | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-232310@lists.php.net to get a copy of this message | ||
From: dktapps at pmmp dot io
Operating system: Windows 10
PHP version: 7.4.15
Package: Reproducible crash
Bug Type: Bug
Bug description:Error handler that throws ErrorException infinite loop
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.
--
Edit bug report at https://bugs.php.net/bug.php?id=80781&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=80781&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=80781&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=80781&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=80781&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=80781&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=80781&r=support
Expected behavior: https://bugs.php.net/fix.php?id=80781&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=80781&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=80781&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=80781&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=80781&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=80781&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=80781&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=80781&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=80781&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=80781&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=80781&r=mysqlcfg