Bug #80976 [Com]: eval() with error code causes php to crash instead of throwing an exception
Edit report at https://bugs.php.net/bug.php?id=80976&edit=1
ID: 80976
Comment by: vicreal at yandex dot ru
Reported by: vicreal at yandex dot ru
Summary: eval() with error code causes php to crash instead
of throwing an exception
Status: Feedback
Type: Bug
Package: *General Issues
Operating System: Debian 10.5
PHP Version: 8.0.3
Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
> What do you mean with "crash" â a segfault?
Yes. But this is an xdebug bug, not php bug.
Previous Comments:
------------------------------------------------------------------------
[2021-05-05 15:55:26] cmb@php.net
What do you mean with "crash" â a segfault? The code is supposed
to issue a fatal error[1]; I would expect that to produce a 500
Internal Server Error, but I don't know about FPM, and your exact
setup.
[1] <https://3v4l.org/i733n>
------------------------------------------------------------------------
[2021-04-22 09:45:57] vicreal at yandex dot ru
Additional examples:
try {
eval('ttt();');
echo 'OK';
} catch (Error $e) {
echo $e->getMessage(); // "Call to undefined function ttt()"
}
exit(0);
Actual result: "Call to undefined function ttt()".
Expected result: "Call to undefined function ttt()".
try {
eval('ttt();');
echo 'OK';
} catch (Error $e) {
echo $e->getMessage();
throw $e; // Connection reset by peer => 502 Bad Gateway
}
exit(0);
Actual result: Connection reset by peer => 502 Bad Gateway.
Expected result: Throwing an exception with message "Call to undefined function ttt()".
Conclusion: an exception is thrown, but if it is not caught, the php process crashes.
------------------------------------------------------------------------
[2021-04-22 09:38:12] vicreal at yandex dot ru
Description:
------------
Debian 10.5 + php-fpm 8.0.3
eval() with error code causes php to crash instead of throwing an exception
Test script:
---------------
eval('ttt();'); // Connection reset by peer => 502 Bad Gateway
echo 'OK';
exit(0);
Expected result:
----------------
Throwing an exception with message "Call to undefined function ttt()".
Actual result:
--------------
Connection reset by peer => 502 Bad Gateway.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=80976&edit=1
Thread (5 messages)