Bug #80976 [Fbk->Nab]: eval() with error code causes php to crash instead of throwing an exception

From: Date: Wed, 05 May 2021 17:28:56 +0000
Subject: Bug #80976 [Fbk->Nab]: 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-233702@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:             Feedback
+Status:             Not a bug
 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:

Ah, thanks!  Then please open a ticket at
<https://bugs.xdebug.org/> if not already done.


Previous Comments:
------------------------------------------------------------------------
[2021-05-05 17:25:04] vicreal at yandex dot ru

> What do you mean with "crash" – a segfault?
Yes. But this is an xdebug bug, not php bug.

------------------------------------------------------------------------
[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)

« previous php.bugs (#233702) next »