Commit:    83ced9124ea0f7be4950b8267b518b05c70323fe
Author:    Stanislav Malyshev <s...@php.net>         Sun, 21 Jul 2013 22:47:10 
-0700
Parents:   476924ec3dbc3e500dc14576e3375f03d8e8f824
Branches:  PHP-5.5 master

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

Log:
Fix bug #61697 - spl_autoload_functions returns lambda functions incorrectly

Bugs:
https://bugs.php.net/61697

Changed paths:
  M  NEWS
  M  UPGRADING
  M  ext/spl/php_spl.c
  M  ext/spl/tests/bug61697.phpt


Diff:
diff --git a/NEWS b/NEWS
index 540daf2..18bb2fd 100644
--- 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)
diff --git a/UPGRADING b/UPGRADING
index 741bcd9..14e19aa 100755
--- 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
 ========================================
diff --git a/ext/spl/php_spl.c b/ext/spl/php_spl.c
index 35f4e50..c3a774e 100644
--- a/ext/spl/php_spl.c
+++ b/ext/spl/php_spl.c
@@ -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);
                }
diff --git a/ext/spl/tests/bug61697.phpt b/ext/spl/tests/bug61697.phpt
index d95caef..064aaa2 100644
--- a/ext/spl/tests/bug61697.phpt
+++ b/ext/spl/tests/bug61697.phpt
@@ -1,7 +1,5 @@
 --TEST--
 Bug #61697 (spl_autoload_functions returns lambda functions incorrectly)
---XFAIL--
-Bug #61697 not fixed yet
 --FILE--
 <?php


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

Reply via email to