Bug #80976 [Opn->Fbk]: eval() with error code causes php to crash instead of throwing an exception
| From: | cmb@php.net | Date: | Wed, 05 May 2021 15:55:26 +0000 |
| Subject: | Bug #80976 [Opn->Fbk]: eval() with error code causes php to crash instead of throwing an exception | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-233699@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=80976&edit=1
ID: 80976
Updated by: cmb@php.net
Reported by: vicreal at yandex dot ru
Summary: eval() with error code causes php to crash instead
of throwing an exception
-Status: Open
+Status: Feedback
Type: Bug
Package: *General Issues
Operating System: Debian 10.5
PHP Version: 8.0.3
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
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>
Previous Comments:
------------------------------------------------------------------------
[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