summaryrefslogtreecommitdiff
path: root/ext/spl/php_spl.c
diff options
context:
space:
mode:
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 */