colder Mon Apr 20 14:20:20 2009 UTC
Added files: (Branch: PHP_5_3)
/php-src/ext/spl/tests bug48023.phpt
Modified files:
/php-src/ext/spl php_spl.c
/php-src NEWS
Log:
MFH: Fix #48023 (spl_autoload_register didn't store closures)
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.c?r1=1.52.2.28.2.17.2.35&r2=1.52.2.28.2.17.2.36&diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.52.2.28.2.17.2.35
php-src/ext/spl/php_spl.c:1.52.2.28.2.17.2.36
--- php-src/ext/spl/php_spl.c:1.52.2.28.2.17.2.35 Mon Jan 26 11:38:03 2009
+++ php-src/ext/spl/php_spl.c Mon Apr 20 14:20:20 2009
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_spl.c,v 1.52.2.28.2.17.2.35 2009/01/26 11:38:03 colder Exp $ */
+/* $Id: php_spl.c,v 1.52.2.28.2.17.2.36 2009/04/20 14:20:20 colder Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -353,6 +353,7 @@
typedef struct {
zend_function *func_ptr;
zval *obj;
+ zval *closure;
zend_class_entry *ce;
} autoload_func_info;
@@ -361,6 +362,9 @@
if (alfi->obj) {
zval_ptr_dtor(&alfi->obj);
}
+ if (alfi->closure) {
+ zval_ptr_dtor(&alfi->closure);
+ }
}
/* {{{ proto void spl_autoload_call(string class_name)
@@ -488,9 +492,14 @@
RETURN_FALSE;
}
}
+ alfi.closure = NULL;
alfi.ce = fcc.calling_scope;
alfi.func_ptr = fcc.function_handler;
obj_ptr = fcc.object_ptr;
+ if (Z_TYPE_P(zcallable) == IS_OBJECT) {
+ alfi.closure = zcallable;
+ Z_ADDREF_P(zcallable);
+ }
if (error) {
efree(error);
}
@@ -527,6 +536,7 @@
spl_alfi.func_ptr = spl_func_ptr;
spl_alfi.obj = NULL;
spl_alfi.ce = NULL;
+ spl_alfi.closure = NULL;
zend_hash_add(SPL_G(autoload_functions),
"spl_autoload", sizeof("spl_autoload"), &spl_alfi, sizeof(autoload_func_info),
NULL);
if (prepend &&
SPL_G(autoload_functions)->nNumOfElements > 1) {
/* Move the newly created element to the head
of the hashtable */
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.564&r2=1.2027.2.547.2.965.2.565&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.965.2.564
php-src/NEWS:1.2027.2.547.2.965.2.565
--- php-src/NEWS:1.2027.2.547.2.965.2.564 Mon Apr 20 14:08:43 2009
+++ php-src/NEWS Mon Apr 20 14:20:20 2009
@@ -12,6 +12,7 @@
disable this behaviour using "http"=>array("auto_decode"=>0) in stream
context. (Dmitry)
+- Fixed bug #48023 (spl_autoload_register didn't store closures). (Etienne)
- Fixed bug #47880 (crashes in call_user_func_array()). (Dmitry)
- Fixed bug #47856 (stristr() converts needle to lower-case). (Ilia)
- Fixed bug #47851 (is_callable throws fatal error). (Dmitry)
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/bug48023.phpt?view=markup&rev=1.1
Index: php-src/ext/spl/tests/bug48023.phpt
+++ php-src/ext/spl/tests/bug48023.phpt
--TEST--
Bug #48023 (spl_autoload_register didn't addref closures)
--FILE--
<?php
spl_autoload_register(function(){});
new Foo;
?>
===DONE===
--EXPECTF--
Fatal error: Class 'Foo' not found in %s on line %d
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php