]> granicus.if.org Git - php/commitdiff
Fixed bug #45744 (Case sensitive callback behaviour)
authorDmitry Stogov <dmitry@php.net>
Thu, 7 Aug 2008 12:04:14 +0000 (12:04 +0000)
committerDmitry Stogov <dmitry@php.net>
Thu, 7 Aug 2008 12:04:14 +0000 (12:04 +0000)
Zend/tests/bug45744.phpt [new file with mode: 0644]
Zend/zend_API.c

diff --git a/Zend/tests/bug45744.phpt b/Zend/tests/bug45744.phpt
new file mode 100644 (file)
index 0000000..029efcf
--- /dev/null
@@ -0,0 +1,40 @@
+--TEST--
+Bug #45744 (Case sensitive callback behaviour)
+--FILE--
+<?php
+class Foo {
+    public function __construct(array $data) {
+               var_dump(array_map(array($this, 'callback'), $data));
+    }
+    
+    private function callback($value) {
+        if (!is_array($value)) {
+            return stripslashes($value);
+        }
+       return array_map(array($this, 'callback'), $value);
+    }
+}
+
+class Bar extends Foo {
+}
+
+new Bar(array());
+
+class Foo2 {
+    public function __construct(array $data) {
+               var_dump(array_map(array($this, 'callBack'), $data));
+    }
+    
+    private function callBack($value) {
+    }
+}
+
+class Bar2 extends Foo2 {
+}
+
+new Bar2(array());
+--EXPECT--
+array(0) {
+}
+array(0) {
+}
index bf76f7b55d07adedc57ca732425b0227d610dfd3..da7548f40793a125d75647059830fd11e3e091a7 100644 (file)
@@ -2472,7 +2472,6 @@ static int zend_is_callable_check_func(int check_flags, zval *callable, zend_fca
                retval = fcc->function_handler ? 1 : 0;
                call_via_handler = 1;
        }
-       efree(lmname);
 
        if (retval) {
                if (fcc->calling_scope && !call_via_handler) {
@@ -2507,7 +2506,7 @@ static int zend_is_callable_check_func(int check_flags, zval *callable, zend_fca
                        }
                        if (retval && (check_flags & IS_CALLABLE_CHECK_NO_ACCESS) == 0) {
                                if (fcc->function_handler->op_array.fn_flags & ZEND_ACC_PRIVATE) {
-                                       if (!zend_check_private(fcc->function_handler, fcc->object_pp ? Z_OBJCE_PP(fcc->object_pp) : EG(scope), mname, mlen TSRMLS_CC)) {
+                                       if (!zend_check_private(fcc->function_handler, fcc->object_pp ? Z_OBJCE_PP(fcc->object_pp) : EG(scope), lmname, mlen TSRMLS_CC)) {
                                                if (error) {
                                                        if (*error) {
                                                                efree(*error);
@@ -2536,6 +2535,8 @@ static int zend_is_callable_check_func(int check_flags, zval *callable, zend_fca
                        if (error) zend_spprintf(error, 0, "function '%s' does not exist", mname);
                }
        }
+       efree(lmname);
+
        if (fcc->object_pp) {
                fcc->called_scope = Z_OBJCE_PP(fcc->object_pp);
        }