]> granicus.if.org Git - php/commitdiff
Fixed bug #34678 (__call(), is_callable() and static methods)
authorDmitry Stogov <dmitry@php.net>
Mon, 3 Oct 2005 09:10:28 +0000 (09:10 +0000)
committerDmitry Stogov <dmitry@php.net>
Mon, 3 Oct 2005 09:10:28 +0000 (09:10 +0000)
Zend/tests/bug34678.phpt [new file with mode: 0755]
Zend/zend_API.c

diff --git a/Zend/tests/bug34678.phpt b/Zend/tests/bug34678.phpt
new file mode 100755 (executable)
index 0000000..2a13201
--- /dev/null
@@ -0,0 +1,25 @@
+--TEST--
+Bug #34678 (__call(), is_callable() and static methods)
+--FILE--
+<?php
+class A {
+       public function __call($m, $a) {
+               echo "__call\n";
+       }
+}
+
+class B extends A {
+       public static function foo() {
+               echo "foo\n";
+       }
+}
+
+if (is_callable(array('B', 'foo'))) {
+       call_user_func(array('B', 'foo'));
+}
+if (is_callable(array('A', 'foo'))) {
+       call_user_func(array('A', 'foo'));
+}
+?>
+--EXPECT--
+foo
index 22d43f52265459b025d540d1563a69564b18b5f6..c7e1a3f6ee6e4303de10c8b2d2cd40aed52d591c 100644 (file)
@@ -2726,7 +2726,7 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, zval *c
                                                        }
                                                }
                                                /* check for __call too */
-                                               if (retval == 0 && ce->__call != 0) {
+                                               if (retval == 0 && *zobj_ptr_ptr && ce->__call != 0) {
                                                        retval = 1;
                                                }
                                                efree(lcname);