summaryrefslogtreecommitdiff
path: root/Zend
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2012-09-21 13:07:14 +0400
committerDmitry Stogov <dmitry@zend.com>2012-09-21 13:07:14 +0400
commit4db74b7f1981bf19805e815f983c50d93df2c26a (patch)
tree352a3e86012d4e57920b96e2cbdddc7b5c0cf383 /Zend
parentfd0b3ea663431b7adaedde11668fbc0b6ba07494 (diff)
downloadphp-git-4db74b7f1981bf19805e815f983c50d93df2c26a.tar.gz
Fixed bug #63111 (is_callable() lies for abstract static method)
Diffstat (limited to 'Zend')
-rw-r--r--Zend/tests/bug63111.phpt36
-rw-r--r--Zend/zend_API.c9
2 files changed, 44 insertions, 1 deletions
diff --git a/Zend/tests/bug63111.phpt b/Zend/tests/bug63111.phpt
new file mode 100644
index 0000000000..3f19068668
--- /dev/null
+++ b/Zend/tests/bug63111.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Bug #63111 (is_callable() lies for abstract static method)
+--FILE--
+<?php
+abstract class Foo {
+ abstract static function bar();
+}
+interface MyInterface {
+ static function bar();
+}
+abstract class Bar {
+ static function foo() {
+ echo "ok\n";
+ }
+}
+var_dump(is_callable(array("Foo", "bar")));
+var_dump(is_callable("Foo::bar"));
+var_dump(is_callable(array("MyInterface", "bar")));
+var_dump(is_callable("MyInterface::bar"));
+var_dump(is_callable(array("Bar", "foo")));
+var_dump(is_callable("Bar::foo"));
+Bar::foo();
+Foo::bar();
+?>
+--EXPECTF--
+Strict Standards: Static function Foo::bar() should not be abstract in %sbug63111.php on line 3
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(true)
+bool(true)
+ok
+
+Fatal error: Cannot call abstract method Foo::bar() in %sbug63111.php on line 20
+
diff --git a/Zend/zend_API.c b/Zend/zend_API.c
index cf96743ee2..d529775764 100644
--- a/Zend/zend_API.c
+++ b/Zend/zend_API.c
@@ -2603,7 +2603,14 @@ get_function_via_handler:
if (retval) {
if (fcc->calling_scope && !call_via_handler) {
- if (!fcc->object_ptr && !(fcc->function_handler->common.fn_flags & ZEND_ACC_STATIC)) {
+ if (!fcc->object_ptr && (fcc->function_handler->common.fn_flags & ZEND_ACC_ABSTRACT)) {
+ if (error) {
+ zend_spprintf(error, 0, "cannot call abstract method %s::%s()", fcc->calling_scope->name, fcc->function_handler->common.function_name);
+ retval = 0;
+ } else {
+ zend_error(E_ERROR, "Cannot call abstract method %s::%s()", fcc->calling_scope->name, fcc->function_handler->common.function_name);
+ }
+ } else if (!fcc->object_ptr && !(fcc->function_handler->common.fn_flags & ZEND_ACC_STATIC)) {
int severity;
char *verb;
if (fcc->function_handler->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {