com php-src: Fix autoload_func_info destruction: ext/ spl/php_spl.c

[email protected] (Nikita Popov)
Newsgroups php.cvs
Message-ID <[email protected]>
Commit:    708973c9bd4a34482d3d6b2921d4b9b1339bddf0
Author:    Nikita Popov <[email protected]>         Thu, 16 Feb 2017 16:59:17 +0100
Parents:   3b91ed112ff06d6b38a6db9e28649f2b79b40cad
Branches:  PHP-7.0 PHP-7.1 master

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

Log:
Fix autoload_func_info destruction

Can't reference the function ptr after the closure has been
destroyed.

Changed paths:
  M  ext/spl/php_spl.c


Diff:
diff --git a/ext/spl/php_spl.c b/ext/spl/php_spl.c
index aab10e5..b8e10a5 100644
--- a/ext/spl/php_spl.c
+++ b/ext/spl/php_spl.c
@@ -378,14 +378,14 @@ static void autoload_func_info_dtor(zval *element)
 	if (!Z_ISUNDEF(alfi->obj)) {
 		zval_ptr_dtor(&alfi->obj);
 	}
-	if (!Z_ISUNDEF(alfi->closure)) {
-		zval_ptr_dtor(&alfi->closure);
-	}
 	if (alfi->func_ptr &&
 		UNEXPECTED(alfi->func_ptr->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE)) {
 		zend_string_release(alfi->func_ptr->common.function_name);
 		zend_free_trampoline(alfi->func_ptr);
 	}
+	if (!Z_ISUNDEF(alfi->closure)) {
+		zval_ptr_dtor(&alfi->closure);
+	}
 	efree(alfi);
 }
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.