|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2021-04-22 09:38 UTC] 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.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 07:00:01 2025 UTC |
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.