com php-src: improve signal globals consistency check for TS: Zend/zend_signal.c

[email protected] (Anatol Belski)
Newsgroups php.cvs
Message-ID <[email protected]>
Commit:    18f7e262570b8766cf6d7f7e0990affe687fa098
Author:    Anatol Belski <[email protected]>         Thu, 2 Mar 2017 20:27:27 +0100
Parents:   c7b2c698d03466959874d933b1a44be125e25e4f
Branches:  PHP-7.0 PHP-7.1 master

Link:       http://git.php.net/?p=php-src.git;a=commitdiff;h=18f7e262570b8766cf6d7f7e0990affe687fa098

Log:
improve signal globals consistency check for TS

Seems when we receive TERM, TLS is destroyed completely. In that case,
not only signal globals, but the entire globals array doesn't exist
anymore.

Changed paths:
  M  Zend/zend_signal.c


Diff:
diff --git a/Zend/zend_signal.c b/Zend/zend_signal.c
index ba550a1..b12f30d 100644
--- a/Zend/zend_signal.c
+++ b/Zend/zend_signal.c
@@ -79,7 +79,7 @@ void zend_signal_handler_defer(int signo, siginfo_t *siginfo, void *context)
 #ifdef ZTS
 	ZEND_TSRMLS_CACHE_UPDATE();
 	/* A signal could hit after TSRM shutdown, in this case globals are already freed. */
-	if (NULL == TSRMG_BULK_STATIC(zend_signal_globals_id, zend_signal_globals_t *)) {
+	if (NULL == TSRMLS_CACHE || NULL == TSRMG_BULK_STATIC(zend_signal_globals_id, zend_signal_globals_t *)) {
 		is_handling_safe = 0;
 	}
 #endif
@@ -169,7 +169,7 @@ static void zend_signal_handler(int signo, siginfo_t *siginfo, void *context)
 	sigset_t sigset;
 	zend_signal_entry_t p_sig;
 #ifdef ZTS
-	if (NULL == TSRMG_BULK_STATIC(zend_signal_globals_id, zend_signal_globals_t *)) {
+	if (NULL == TSRMLS_CACHE || NULL == TSRMG_BULK_STATIC(zend_signal_globals_id, zend_signal_globals_t *)) {
 		p_sig.flags = 0;
 		p_sig.handler = SIG_DFL;
 	} else
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.