mirror of
https://github.com/php/php-src.git
synced 2024-09-22 10:27:25 +00:00
- Bugfix #32290
This commit is contained in:
parent
83c13d22e9
commit
565e832edf
35
Zend/tests/bug32290.phpt
Executable file
35
Zend/tests/bug32290.phpt
Executable file
@ -0,0 +1,35 @@
|
||||
--TEST--
|
||||
Bug #32290 (calling call_user_func_array() ends in infinite loop within child class)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class TestA
|
||||
{
|
||||
public function doSomething($i)
|
||||
{
|
||||
echo __METHOD__ . "($this)\n";
|
||||
return --$i;
|
||||
}
|
||||
}
|
||||
|
||||
class TestB extends TestA
|
||||
{
|
||||
public function doSomething($i)
|
||||
{
|
||||
echo __METHOD__ . "($this)\n";
|
||||
$i++;
|
||||
if ($i >= 5) return 5;
|
||||
return call_user_func_array(array("TestA","doSomething"), array($i));
|
||||
}
|
||||
}
|
||||
|
||||
$x = new TestB();
|
||||
var_dump($x->doSomething(1));
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
TestB::doSomething(Object id #%d)
|
||||
TestA::doSomething(Object id #%d)
|
||||
int(1)
|
||||
===DONE===
|
@ -693,6 +693,14 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
|
||||
}
|
||||
EX(function_state).function =
|
||||
Z_OBJ_HT_PP(fci->object_pp)->get_method(fci->object_pp, Z_STRVAL_P(fci->function_name), Z_STRLEN_P(fci->function_name) TSRMLS_CC);
|
||||
if (EX(function_state).function && calling_scope != EX(function_state).function->common.scope) {
|
||||
char *function_name_lc = zend_str_tolower_dup(Z_STRVAL_P(fci->function_name), Z_STRLEN_P(fci->function_name));
|
||||
if (zend_hash_find(&calling_scope->function_table, function_name_lc, fci->function_name->value.str.len+1, (void **) &EX(function_state).function)==FAILURE) {
|
||||
efree(function_name_lc);
|
||||
zend_error(E_ERROR, "Object does not support parent class method calls");
|
||||
}
|
||||
efree(function_name_lc);
|
||||
}
|
||||
} else if (calling_scope) {
|
||||
char *function_name_lc = zend_str_tolower_dup(Z_STRVAL_P(fci->function_name), Z_STRLEN_P(fci->function_name));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user