Bug #80781 [Opn->Csd]: Error handler that throws ErrorException infinite loop

From: Date: Mon, 22 Feb 2021 08:38:58 +0000
Subject: Bug #80781 [Opn->Csd]: Error handler that throws ErrorException infinite loop
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-232312@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80781&edit=1 ID: 80781 Updated by: nikic@php.net Reported by: dktapps at pmmp dot io Summary: Error handler that throws ErrorException infinite loop -Status: Open +Status: Closed Type: Bug Package: Reproducible crash Operating System: Windows 10 PHP Version: 7.4.15 Block user comment: N Private report: N New Comment: 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 Previous Comments: ------------------------------------------------------------------------ [2021-02-22 00:58:13] 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. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=80781&edit=1

« previous php.bugs (#232312) next »