]> granicus.if.org Git - php/commitdiff
Fix bug #61697 - spl_autoload_functions returns lambda functions incorrectly
authorStanislav Malyshev <stas@php.net>
Mon, 22 Jul 2013 05:47:10 +0000 (22:47 -0700)
committerStanislav Malyshev <stas@php.net>
Mon, 22 Jul 2013 05:47:10 +0000 (22:47 -0700)
NEWS
UPGRADING
ext/spl/php_spl.c
ext/spl/tests/bug61697.phpt

diff --git a/NEWS b/NEWS
index 540daf24d0f93fe77ac23c3b88d8429aafcdc978..18bb2fd013fe939bd9f8b5f762ae0dd686f15cd5 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -13,6 +13,8 @@ PHP                                                                        NEWS
 - SPL:
   . Added RecursiveTreeIterator setPostfix and getPostifx methods. (Joshua 
     Thijssen)
+  . Fixed bug #61697 (spl_autoload_functions returns lambda functions 
+    incorrectly). (Laruence)
 
 - Streams:
   . Fixed bug #65268 (select() implementation uses outdated tick API). (Anatol)
index 741bcd9683e22598e11432baceec05558800230c..14e19aa58359a201082bdfee026cb3bcac7148dc 100755 (executable)
--- a/UPGRADING
+++ b/UPGRADING
@@ -179,6 +179,9 @@ PHP 5.5 UPGRADE NOTES
 - Functions in the socket extension now do not emit warnings when the
   errno is EAGAIN, EWOULDBLOCK or EINPROGRESS.
 
+- Since 5.5.2, spl_autoload_functions() returns different names for 
+  different lambda functions registered via spl_autoload_register().
+
 ========================================
 5. New Functions
 ========================================
index 35f4e5056bb4546980b83cb7ff54cd1c0ac7821c..c3a774ea96d5708afc36ce5e39da175812be2581 100644 (file)
@@ -743,8 +743,17 @@ PHP_FUNCTION(spl_autoload_functions)
                                }
                                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, alfi->func_ptr->common.function_name, 1);
+                       } else {
+                               if (strncmp(alfi->func_ptr->common.function_name, ZEND_STRL("__lambda_func"))) {
+                                       add_next_index_string(return_value, alfi->func_ptr->common.function_name, 1);
+                               } else {
+                                  char *key;
+                                  uint len;
+                                  long dummy;
+                                  zend_hash_get_current_key_ex(SPL_G(autoload_functions), &key, &len, &dummy, 0, &function_pos); 
+                                  add_next_index_stringl(return_value, key, len - 1, 1);
+                               }
+                       }
 
                        zend_hash_move_forward_ex(SPL_G(autoload_functions), &function_pos);
                }
index d95caef97859507bcfc70e1b10bdc8781143d5e6..064aaa2e2bf1974b5c371938c14690b38ed269ea 100644 (file)
@@ -1,7 +1,5 @@
 --TEST--
 Bug #61697 (spl_autoload_functions returns lambda functions incorrectly)
---XFAIL--
-Bug #61697 not fixed yet
 --FILE--
 <?php