summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Pena <felipe@php.net>2009-07-15 01:11:24 +0000
committerFelipe Pena <felipe@php.net>2009-07-15 01:11:24 +0000
commitbffd08072c607807ef6215920152ff223c5ee620 (patch)
tree555f893a9ecc339880ab68fd391240416020e2b9
parent912131b304b0caebd3908df1871c7e971ad4556b (diff)
downloadphp-git-bffd08072c607807ef6215920152ff223c5ee620.tar.gz
- MFH: Fixed bug #48899 (is_callable returns true even if method does not exist in parent class)
-rw-r--r--NEWS2
-rw-r--r--Zend/tests/bug48899.phpt24
-rw-r--r--Zend/zend_API.c2
3 files changed, 27 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 7acd4c26ea..9ff669bd32 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,8 @@ PHP NEWS
- Fixed open_basedir circumvention for mail.log. (Maksymilian Arciemowicz,
Stas)
+- Fixed bug #48899 (is_callable returns true even if method does not exist in
+ parent class). (Felipe)
- Fixed bug #48854 (array_merge_recursive modifies arrays after first one).
(Felipe)
- Fixed bug #48788 (RecursiveDirectoryIterator doesn't descend into symlinked
diff --git a/Zend/tests/bug48899.phpt b/Zend/tests/bug48899.phpt
new file mode 100644
index 0000000000..ff640543cb
--- /dev/null
+++ b/Zend/tests/bug48899.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Bug #48899 (is_callable returns true even if method does not exist in parent class)
+--FILE--
+<?php
+
+class ParentClass { }
+
+class ChildClass extends ParentClass {
+ public function testIsCallable() {
+ var_dump(is_callable(array($this, 'parent::testIsCallable')));
+ }
+ public function testIsCallable2() {
+ var_dump(is_callable(array($this, 'static::testIsCallable2')));
+ }
+}
+
+$child = new ChildClass();
+$child->testIsCallable();
+$child->testIsCallable2();
+
+?>
+--EXPECT--
+bool(false)
+bool(true)
diff --git a/Zend/zend_API.c b/Zend/zend_API.c
index d4c1036a74..bb263fab6c 100644
--- a/Zend/zend_API.c
+++ b/Zend/zend_API.c
@@ -2519,7 +2519,7 @@ static int zend_is_callable_check_func(int check_flags, zval *callable, zend_fca
}
} else {
get_function_via_handler:
- if (fcc->object_ptr) {
+ if (fcc->object_ptr && fcc->calling_scope == ce_org) {
if (Z_OBJ_HT_P(fcc->object_ptr)->get_method) {
fcc->function_handler = Z_OBJ_HT_P(fcc->object_ptr)->get_method(&fcc->object_ptr, mname, mlen TSRMLS_CC);
if (fcc->function_handler) {