[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-cvs
Subject:    [PHP-CVS] cvs: php-src(PHP_5_3) /ext/spl php_spl.c  /ext/spl/tests bug40091.phpt
From:       "Etienne Kneuss" <colder () php ! net>
Date:       2008-02-29 13:55:23
Message-ID: cvscolder1204293323 () cvsserver
[Download RAW message or body]

colder		Fri Feb 29 13:55:23 2008 UTC

  Modified files:              (Branch: PHP_5_3)
    /php-src/ext/spl	php_spl.c 
    /php-src/ext/spl/tests	bug40091.phpt 
  Log:
  MFH: Fix #44144 (object methods as spl autoload functions returned correctly)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.c?r1=1.52.2.28.2.17.2.13&r2=1.52.2.28.2.17.2.14&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.13 \
                php-src/ext/spl/php_spl.c:1.52.2.28.2.17.2.14
--- php-src/ext/spl/php_spl.c:1.52.2.28.2.17.2.13	Mon Feb 25 23:39:08 2008
+++ php-src/ext/spl/php_spl.c	Fri Feb 29 13:55:23 2008
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: php_spl.c,v 1.52.2.28.2.17.2.13 2008/02/25 23:39:08 colder Exp $ */
+/* $Id: php_spl.c,v 1.52.2.28.2.17.2.14 2008/02/29 13:55:23 colder Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -587,8 +587,9 @@
  Return all registered __autoload() functionns */
 PHP_FUNCTION(spl_autoload_functions)
 {
-	zend_function *fptr, **func_ptr_ptr;
+	zend_function *fptr;
 	HashPosition function_pos;
+	autoload_func_info *alfi;
 
 	if (!EG(autoload_func)) {
 		if (zend_hash_find(EG(function_table), ZEND_AUTOLOAD_FUNC_NAME, \
sizeof(ZEND_AUTOLOAD_FUNC_NAME), (void **) &fptr) == SUCCESS) { @@ -605,17 +606,22 @@
 		array_init(return_value);
 		zend_hash_internal_pointer_reset_ex(SPL_G(autoload_functions), &function_pos);
 		while(zend_hash_has_more_elements_ex(SPL_G(autoload_functions), &function_pos) == \
                SUCCESS) {
-			zend_hash_get_current_data_ex(SPL_G(autoload_functions), (void **) &func_ptr_ptr, \
                &function_pos);
-			if ((*func_ptr_ptr)->common.scope) {
+			zend_hash_get_current_data_ex(SPL_G(autoload_functions), (void **) &alfi, \
&function_pos); +			if (alfi->func_ptr->common.scope) {
 				zval *tmp;
 				MAKE_STD_ZVAL(tmp);
 				array_init(tmp);
 
-				add_next_index_string(tmp, (*func_ptr_ptr)->common.scope->name, 1);
-				add_next_index_string(tmp, (*func_ptr_ptr)->common.function_name, 1);
+				if (alfi->obj) {
+					Z_ADDREF_P(alfi->obj);
+					add_next_index_zval(tmp, alfi->obj);
+				} else {
+					add_next_index_string(tmp, alfi->ce->name, 1);
+				}
+				add_next_index_string(tmp, alfi->func_ptr->common.function_name, 1);
 				add_next_index_zval(return_value, tmp);
 			} else
-				add_next_index_string(return_value, (*func_ptr_ptr)->common.function_name, 1);
+				add_next_index_string(return_value, alfi->func_ptr->common.function_name, 1);
 
 			zend_hash_move_forward_ex(SPL_G(autoload_functions), &function_pos);
 		}
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/bug40091.phpt?r1=1.1.2.1&r2=1.1.2.1.2.1&diff_format=u
                
Index: php-src/ext/spl/tests/bug40091.phpt
diff -u php-src/ext/spl/tests/bug40091.phpt:1.1.2.1 \
                php-src/ext/spl/tests/bug40091.phpt:1.1.2.1.2.1
--- php-src/ext/spl/tests/bug40091.phpt:1.1.2.1	Wed Jan 10 18:14:37 2007
+++ php-src/ext/spl/tests/bug40091.phpt	Fri Feb 29 13:55:23 2008
@@ -25,13 +25,19 @@
 (
     [0] => Array
         (
-            [0] => MyAutoloader
+            [0] => MyAutoloader Object
+                (
+                )
+
             [1] => autoload
         )
 
     [1] => Array
         (
-            [0] => MyAutoloader
+            [0] => MyAutoloader Object
+                (
+                )
+
             [1] => autoload
         )
 

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic