]> 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:12:19 +0000 (09:12 +0000)
committerDmitry Stogov <dmitry@php.net>
Mon, 3 Oct 2005 09:12:19 +0000 (09:12 +0000)
NEWS
Zend/tests/bug34678.phpt [new file with mode: 0755]
Zend/zend_API.c

diff --git a/NEWS b/NEWS
index db218c490b4344759899fb2e53f91a30f0f79400..19e4f2a646b3e934a4ad0afa468042bf6b0bdb0f 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -40,6 +40,7 @@ PHP                                                                        NEWS
 - Fixed "make test" to work for phpized extensions. (Hartmut, Jani)
 - Fixed failing queries (FALSE returned) with mysqli_query() on 64 bit systems.
   (Andrey)
+- Fixed bug #34678 (__call(), is_callable() and static methods). (Dmitry)
 - Fixed bug #34645 (ctype corrupts memory when validating large numbers). (Ilia)
 - Fixed bug #34643 (wsdl default value has no effect). (Dmitry)
 - Fixed bug #34617 (zend_deactivate: objects_store used after
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 8be11c71f796ac8a00dfd7b313d9b309e27bf0cb..63df1b60b73bd7c16b459a7f2eb2acdfe48e8981 100644 (file)
@@ -2068,7 +2068,7 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, char **
                                                        }
                                                }
                                                /* check for __call too */
-                                               if (retval == 0 && ce->__call != 0) {
+                                               if (retval == 0 && *zobj_ptr_ptr && ce->__call != 0) {
                                                        retval = 1;
                                                }
                                                efree(lcname);