Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 33dd226

Browse files
committed
Merge branch 'PHP-8.2'
* PHP-8.2: Fix GH-8789 and GH-10015: Fix ZTS zend signal crashes due to NULL globals
2 parents b19f556 + d479b5a commit 33dd226

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

‎Zend/zend_signal.c‎

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -87,18 +87,14 @@ 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_is_managed_thread()) {
9294
/* Forward to default handler handler */
9395
zend_signal_handler(signo, siginfo, context);
9496
return;
9597
}
96-
97-
if (!tsrm_is_managed_thread()) {
98-
fprintf(stderr, "zend_signal_handler_defer() called in a thread not managed by PHP. The expected signal handler will not be called. This is probably a bug.\n");
99-
100-
return;
101-
}
10298
#endif
10399

104100
if (EXPECTED(SIGG(active))) {
@@ -186,7 +182,7 @@ static void zend_signal_handler(int signo, siginfo_t *siginfo, void *context)
186182
sigset_t sigset;
187183
zend_signal_entry_t p_sig;
188184
#ifdef ZTS
189-
if (tsrm_is_shutdown()) {
185+
if (tsrm_is_shutdown()|| !tsrm_is_managed_thread()) {
190186
p_sig.flags = 0;
191187
p_sig.handler = SIG_DFL;
192188
} else

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /