[php-src] PR #12314: Fix GH-12099: phpdbg abort/segfault (php 8.1.21)
| From: | nielsdos | Date: | Thu, 28 Sep 2023 19:14:16 +0000 |
| Subject: | [php-src] PR #12314: Fix GH-12099: phpdbg abort/segfault (php 8.1.21) | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-23729@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/12314
Author: nielsdos
In the reporter's example, an unwinding exception is pending in EG(exception) causing
zend_call_function() called from user_shutdown_function_call() to return FAILURE. This then triggers
the assertion in user_shutdown_function_call().
This only happens in PHP 8.1. In PHP 8.2 and up this was indirectly fixed via 485d3acfe6. That
commit made sure that only when EG(active) is false FAILURE can be returned. In other cases SUCCESS
will be returned. As shutdown handlers are only called when EG(active) is true, this means the
assertion never triggers.
We fix it in PHP 8.1 by relaxing the assertion. We should not abort when an exception is pending.
Therefore, when FAILURE is returned, we will check if an exception is pending. If it is not, then we
will fail the assertion. This is more in line with that commit on PHP 8.2 and up.