Skip to content

Commit d479b5a

Browse files
committed
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1: Fix GH-8789 and GH-10015: Fix ZTS zend signal crashes due to NULL globals
2 parents 892f833 + 06ae750 commit d479b5a

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

NEWS

+4
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ PHP NEWS
1313
(mvorisek)
1414
. Fixed bug GH-10801 (Named arguments in CTE functions cause a segfault).
1515
(nielsdos)
16+
. Fixed bug GH-8789 (PHP 8.0.20 (ZTS) zend_signal_handler_defer crashes on
17+
apache). (nielsdos)
18+
. Fixed bug GH-10015 (zend_signal_handler_defer crashes on apache shutdown).
19+
(nielsdos)
1620

1721
- Date:
1822
. Fixed bug GH-10747 (Private and protected properties in serialized Date*

Zend/zend_signal.c

+5-3
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,10 @@ void zend_signal_handler_defer(int signo, siginfo_t *siginfo, void *context)
8787
zend_signal_queue_t *queue, *qtmp;
8888

8989
#ifdef ZTS
90-
/* A signal could hit after TSRM shutdown, in this case globals are already freed. */
91-
if (tsrm_is_shutdown()) {
90+
/* A signal could hit after TSRM shutdown, in this case globals are already freed.
91+
* Or it could be delivered to a thread that didn't execute PHP yet.
92+
* In the latter case we act as if SIGG(active) is false. */
93+
if (tsrm_is_shutdown() || !tsrm_get_ls_cache()) {
9294
/* Forward to default handler handler */
9395
zend_signal_handler(signo, siginfo, context);
9496
return;
@@ -180,7 +182,7 @@ static void zend_signal_handler(int signo, siginfo_t *siginfo, void *context)
180182
sigset_t sigset;
181183
zend_signal_entry_t p_sig;
182184
#ifdef ZTS
183-
if (tsrm_is_shutdown()) {
185+
if (tsrm_is_shutdown() || !tsrm_get_ls_cache()) {
184186
p_sig.flags = 0;
185187
p_sig.handler = SIG_DFL;
186188
} else

0 commit comments

Comments
 (0)