This bug is also exists in 5.4, and previous fix by dsp is not complete
for __callStatic stituation, see test script
?? ??? 2013, PHP 5.4.18
- Core:
+ . Fixed bug #65108 (is_callable() triggers Fatal Error).
+ (David Soria Parra, Laruence)
. Fixed bug #65088 (Generated configure script is malformed on OpenBSD).
(Adam)
--- /dev/null
+--TEST--
+Bug #65108 (is_callable() triggers Fatal Error)
+--FILE--
+<?php
+class C {
+ private function f() {}
+ static function __callStatic($name, $args) {}
+}
+
+class B {
+ public function B() {
+ $isCallable = is_callable(array(new C, 'f'));
+ var_dump($isCallable);
+ }
+}
+
+new B();
+
+Class E {
+ private function f() {}
+ function __call($name, $args) {}
+}
+$isCallable = is_callable(array('E', 'f'));
+var_dump($isCallable);
+--EXPECT--
+bool(false)
+bool(false)
}
if ((check_flags & IS_CALLABLE_CHECK_NO_ACCESS) == 0 &&
(fcc->calling_scope &&
- (fcc->calling_scope->__call ||
- fcc->calling_scope->__callstatic))) {
+ ((fcc->object_ptr && fcc->calling_scope->__call) ||
+ (!fcc->object_ptr && fcc->calling_scope->__callstatic)))) {
if (fcc->function_handler->op_array.fn_flags & ZEND_ACC_PRIVATE) {
if (!zend_check_private(fcc->function_handler, fcc->object_ptr ? Z_OBJCE_P(fcc->object_ptr) : EG(scope), lmname, mlen TSRMLS_CC)) {
retval = 0;