summaryrefslogtreecommitdiff
path: root/ext/spl/php_spl.c
diff options
context:
space:
mode:
authorXinchen Hui <laruence@gmail.com>2015-12-23 08:10:59 -0800
committerXinchen Hui <laruence@gmail.com>2015-12-23 08:10:59 -0800
commit620ccc9b1a0a593786a364af15d45fd797a6cf1f (patch)
tree425967a7187d100ca47e4cd812fd1030e69ae3a0 /ext/spl/php_spl.c
parentea12ff149cdcfe04531c7114cf7a3b8e68cd074c (diff)
downloadphp-git-620ccc9b1a0a593786a364af15d45fd797a6cf1f.tar.gz
Fixed bug #71204 (segfault if clean spl_autoload_funcs while autoloading)
Diffstat (limited to 'ext/spl/php_spl.c')
-rw-r--r--ext/spl/php_spl.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/ext/spl/php_spl.c b/ext/spl/php_spl.c
index 3424b90aea..d3228698de 100644
--- a/ext/spl/php_spl.c
+++ b/ext/spl/php_spl.c
@@ -669,10 +669,14 @@ PHP_FUNCTION(spl_autoload_unregister)
if (SPL_G(autoload_functions)) {
if (func_name_len == sizeof("spl_autoload_call")-1 && !strcmp(lc_name, "spl_autoload_call")) {
/* remove all */
- zend_hash_destroy(SPL_G(autoload_functions));
- FREE_HASHTABLE(SPL_G(autoload_functions));
- SPL_G(autoload_functions) = NULL;
- EG(autoload_func) = NULL;
+ if (!SPL_G(autoload_running)) {
+ zend_hash_destroy(SPL_G(autoload_functions));
+ FREE_HASHTABLE(SPL_G(autoload_functions));
+ SPL_G(autoload_functions) = NULL;
+ EG(autoload_func) = NULL;
+ } else {
+ zend_hash_clean(SPL_G(autoload_functions));
+ }
success = SUCCESS;
} else {
/* remove specific */