diff options
author | Marcus Boerger <helly@php.net> | 2005-03-13 13:24:26 +0000 |
---|---|---|
committer | Marcus Boerger <helly@php.net> | 2005-03-13 13:24:26 +0000 |
commit | 37d8de4ba660b27d7f6381940560ca9dbf6f326c (patch) | |
tree | 2d2727d51d940a38cf0c7366c9b50c02c8110c94 | |
parent | 7256d2ca6a632faad6b7e0795572d2d5cd8f31e9 (diff) | |
download | php-git-37d8de4ba660b27d7f6381940560ca9dbf6f326c.tar.gz |
- MFH
-rwxr-xr-x | Zend/tests/bug32290.phpt | 35 | ||||
-rw-r--r-- | Zend/zend_execute_API.c | 8 | ||||
-rw-r--r-- | Zend/zend_reflection_api.c | 1 | ||||
-rw-r--r-- | ext/reflection/php_reflection.c | 1 |
4 files changed, 45 insertions, 0 deletions
diff --git a/Zend/tests/bug32290.phpt b/Zend/tests/bug32290.phpt new file mode 100755 index 0000000000..f754275ccf --- /dev/null +++ b/Zend/tests/bug32290.phpt @@ -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=== diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index 307fa2d545..ea38c03156 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -690,6 +690,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, "Cannot call method %s::%s() or method does not exist", calling_scope->name, Z_STRVAL_P(fci->function_name)); + } + 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)); diff --git a/Zend/zend_reflection_api.c b/Zend/zend_reflection_api.c index 20e9a1ffc2..1409cd6d8a 100644 --- a/Zend/zend_reflection_api.c +++ b/Zend/zend_reflection_api.c @@ -3051,6 +3051,7 @@ ZEND_METHOD(reflection_property, getValue) } if ((ref->prop->flags & ZEND_ACC_STATIC)) { + zend_update_class_constants(intern->ce TSRMLS_CC); if (zend_hash_quick_find(intern->ce->static_members, ref->prop->name, ref->prop->name_length + 1, ref->prop->h, (void **) &member) == FAILURE) { zend_error(E_ERROR, "Internal error: Could not find the property %s", ref->prop->name); /* Bails out */ diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 20e9a1ffc2..1409cd6d8a 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -3051,6 +3051,7 @@ ZEND_METHOD(reflection_property, getValue) } if ((ref->prop->flags & ZEND_ACC_STATIC)) { + zend_update_class_constants(intern->ce TSRMLS_CC); if (zend_hash_quick_find(intern->ce->static_members, ref->prop->name, ref->prop->name_length + 1, ref->prop->h, (void **) &member) == FAILURE) { zend_error(E_ERROR, "Internal error: Could not find the property %s", ref->prop->name); /* Bails out */ |