Bug #80976 [Com]: eval() with error code causes php to crash instead of throwing an exception
| From: | vicreal at yandex dot ru | Date: | Thu, 22 Apr 2021 09:45:58 +0000 |
| Subject: | Bug #80976 [Com]: 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-233550@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
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: Open
Type: Bug
Package: *General Issues
Operating System: Debian 10.5
PHP Version: 8.0.3
Block user comment: N
Private report: N
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[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