1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 16:22:37 +01:00

MFH: Fixed bug #54910 (Crash when calling call_user_func with unknown function name)

This commit is contained in:
Dmitry Stogov
2011-05-31 11:36:57 +00:00
parent 0de3cd84a5
commit eaeb4537ec
2 changed files with 33 additions and 0 deletions

28
Zend/tests/bug54910.phpt Normal file
View File

@@ -0,0 +1,28 @@
--TEST--
Bug #54910 (Crash when calling call_user_func with unknown function name)
--FILE--
<?php
class A {
public function __call($method, $args) {
if (stripos($method, 'get') === 0) {
return $this->get();
}
die("No such method - '$method'\n");
}
protected function get() {
$class = get_class($this);
$call = array($class, 'noSuchMethod');
if (is_callable($call)) {
call_user_func($call);
}
}
}
class B extends A {}
$input = new B();
echo $input->getEmail();
--EXPECT--
No such method - 'noSuchMethod'

View File

@@ -2773,6 +2773,11 @@ get_function_via_handler:
if (fcc->function_handler) {
retval = 1;
call_via_handler = (fcc->function_handler->common.fn_flags & ZEND_ACC_CALL_VIA_HANDLER) != 0;
if (call_via_handler && !fcc->object_ptr && EG(This) &&
Z_OBJ_HT_P(EG(This))->get_class_entry &&
instanceof_function(Z_OBJCE_P(EG(This)), fcc->calling_scope TSRMLS_CC)) {
fcc->object_ptr = EG(This);
}
}
}
}