summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStanislav Malyshev <stas@php.net>2014-09-01 12:14:57 -0700
committerStanislav Malyshev <stas@php.net>2014-09-01 12:15:54 -0700
commit4b9fcc01d4cd17d3933c8f9c76fb37359117ce2e (patch)
tree5466875f719d4841abdad75188d9d3e80636c1e2
parent21446cd7b6d91f323cbee1250b9f2d551edf9b9c (diff)
parent30aceaf1a7cf9ef6f32806463212323c6ab89f09 (diff)
downloadphp-git-4b9fcc01d4cd17d3933c8f9c76fb37359117ce2e.tar.gz
Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4: update NEWS Only destruct if EG(active) in zend_shutdown(). (bug #65463, #66036) Fix typo from commit 32314f6b6 Fix destruction order in zend_shutdown (bug #65463, #66036)
-rw-r--r--NEWS2
-rw-r--r--Zend/zend.c14
-rw-r--r--Zend/zend_compile.h2
-rw-r--r--Zend/zend_execute_API.c4
4 files changed, 20 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index 459ecf8e1a..3b7a382038 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,8 @@ PHP NEWS
- Core:
. Fixed bug #47358 (glob returns error, should be empty array()). (Pierre)
+ . Fixed bug #65463 (SIGSEGV during zend_shutdown()). (Keyur Govande)
+ . Fixed bug #66036 (Crash on SIGTERM in apache process). (Keyur Govande)
. Fixed bug #67878 (program_prefix not honoured in man pages). (Remi)
- COM:
diff --git a/Zend/zend.c b/Zend/zend.c
index 23b16ce234..cb5c39ba8d 100644
--- a/Zend/zend.c
+++ b/Zend/zend.c
@@ -814,6 +814,20 @@ void zend_shutdown(TSRMLS_D) /* {{{ */
zend_shutdown_timeout_thread();
#endif
zend_destroy_rsrc_list(&EG(persistent_list) TSRMLS_CC);
+
+ if (EG(active))
+ {
+ /*
+ * The order of destruction is important here.
+ * See bugs #65463 and 66036.
+ */
+ zend_hash_reverse_apply(GLOBAL_FUNCTION_TABLE, (apply_func_t) zend_cleanup_function_data_full TSRMLS_CC);
+ zend_hash_reverse_apply(GLOBAL_CLASS_TABLE, (apply_func_t) zend_cleanup_user_class_data TSRMLS_CC);
+ zend_cleanup_internal_classes(TSRMLS_C);
+ zend_hash_reverse_apply(GLOBAL_FUNCTION_TABLE, (apply_func_t) clean_non_persistent_function_full TSRMLS_CC);
+ zend_hash_reverse_apply(GLOBAL_CLASS_TABLE, (apply_func_t) clean_non_persistent_class_full TSRMLS_CC);
+ }
+
zend_destroy_modules();
zend_hash_destroy(GLOBAL_FUNCTION_TABLE);
diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h
index f6b1be96fa..ca2be5c155 100644
--- a/Zend/zend_compile.h
+++ b/Zend/zend_compile.h
@@ -666,6 +666,8 @@ ZEND_API void zend_cleanup_internal_class_data(zend_class_entry *ce TSRMLS_DC);
ZEND_API void zend_cleanup_internal_classes(TSRMLS_D);
ZEND_API int zend_cleanup_function_data(zend_function *function TSRMLS_DC);
ZEND_API int zend_cleanup_function_data_full(zend_function *function TSRMLS_DC);
+ZEND_API int clean_non_persistent_function_full(zend_function *function TSRMLS_DC);
+ZEND_API int clean_non_persistent_class_full(zend_class_entry **ce TSRMLS_DC);
ZEND_API void destroy_zend_function(zend_function *function TSRMLS_DC);
ZEND_API void zend_function_dtor(zend_function *function);
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
index e100484f6f..7e2a3378da 100644
--- a/Zend/zend_execute_API.c
+++ b/Zend/zend_execute_API.c
@@ -109,7 +109,7 @@ static int clean_non_persistent_function(zend_function *function TSRMLS_DC) /* {
}
/* }}} */
-static int clean_non_persistent_function_full(zend_function *function TSRMLS_DC) /* {{{ */
+ZEND_API int clean_non_persistent_function_full(zend_function *function TSRMLS_DC) /* {{{ */
{
return (function->type == ZEND_INTERNAL_FUNCTION) ? ZEND_HASH_APPLY_KEEP : ZEND_HASH_APPLY_REMOVE;
}
@@ -121,7 +121,7 @@ static int clean_non_persistent_class(zend_class_entry **ce TSRMLS_DC) /* {{{ */
}
/* }}} */
-static int clean_non_persistent_class_full(zend_class_entry **ce TSRMLS_DC) /* {{{ */
+ZEND_API int clean_non_persistent_class_full(zend_class_entry **ce TSRMLS_DC) /* {{{ */
{
return ((*ce)->type == ZEND_INTERNAL_CLASS) ? ZEND_HASH_APPLY_KEEP : ZEND_HASH_APPLY_REMOVE;
}