Open
Description
Description
What was fixed 3301d96 #13446 (comment) bc it was broken from 8.3.0-8.3.4 is still broken if the exception handler itself calls exit.
https://3v4l.org/HkWfh
without exit: https://3v4l.org/FTWQf
The following code:
<?php
declare(strict_types=1);
function foo($e) {
var_dump( set_exception_handler('foo') );
restore_exception_handler();
echo "---" . PHP_EOL;
exit;
}
set_exception_handler('foo');
register_shutdown_function(function () {
var_dump( set_exception_handler(null) );
});
strlen(null);
Resulted in this output:
NULL
---
NULL
But I expected this output instead:
NULL
---
string(3) "foo"
This matters, because since PHP 8.3, the exit code of the exit() call in exception handler is used as exit code of PHP
PHP Version
PHP 8.3.0+
Operating System
No response