summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schlüter <johannes@php.net>2007-04-30 19:54:41 +0000
committerJohannes Schlüter <johannes@php.net>2007-04-30 19:54:41 +0000
commite181e3ac7bdf1439b142c17dec6be2b76b776c76 (patch)
tree1758d058223832a9eea34301cfeeb57b37c40c1a
parent618e172ec86d30891c75cd5d8a8b7b0e25e99784 (diff)
downloadphp-git-e181e3ac7bdf1439b142c17dec6be2b76b776c76.tar.gz
- MFH Fix "f" modifier for zend_parse_parameters_ex in case of a __call call
# only affects iterator_apply() in 5_2 branch
-rw-r--r--Zend/zend_API.c17
-rwxr-xr-xext/spl/tests/spl_007.phpt26
2 files changed, 38 insertions, 5 deletions
diff --git a/Zend/zend_API.c b/Zend/zend_API.c
index ad58ac4490..724c6137d3 100644
--- a/Zend/zend_API.c
+++ b/Zend/zend_API.c
@@ -2361,17 +2361,24 @@ ZEND_API int zend_fcall_info_init(zval *callable, zend_fcall_info *fci, zend_fca
fci->size = sizeof(*fci);
fci->function_table = ce ? &ce->function_table : EG(function_table);
fci->object_pp = obj;
- fci->function_name = NULL;
+ fci->function_name = callable;
fci->retval_ptr_ptr = NULL;
fci->param_count = 0;
fci->params = NULL;
fci->no_separation = 1;
fci->symbol_table = NULL;
- fcc->initialized = 1;
- fcc->function_handler = func;
- fcc->calling_scope = ce;
- fcc->object_pp = obj;
+ if (strlen(func->common.function_name) == sizeof(ZEND_CALL_FUNC_NAME) - 1 && !memcmp(func->common.function_name, ZEND_CALL_FUNC_NAME, sizeof(ZEND_CALL_FUNC_NAME))) {
+ fcc->initialized = 0;
+ fcc->function_handler = NULL;
+ fcc->calling_scope = NULL;
+ fcc->object_pp = NULL;
+ } else {
+ fcc->initialized = 1;
+ fcc->function_handler = func;
+ fcc->calling_scope = ce;
+ fcc->object_pp = obj;
+ }
return SUCCESS;
}
diff --git a/ext/spl/tests/spl_007.phpt b/ext/spl/tests/spl_007.phpt
new file mode 100755
index 0000000000..dcd63f9b5a
--- /dev/null
+++ b/ext/spl/tests/spl_007.phpt
@@ -0,0 +1,26 @@
+--TEST--
+SPL: iterator_apply() with callback using __call()
+--SKIPIF--
+<?php if (!extension_loaded("spl")) print "skip"; ?>
+--FILE--
+<?php
+
+class Foo {
+ public function __call($name, $params) {
+ echo "Called $name.\n";
+ return true;
+ }
+}
+
+$it = new ArrayIterator(array(1, 2, 3));
+
+iterator_apply($it, array(new Foo, "foobar"));
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+Called foobar.
+Called foobar.
+Called foobar.
+===DONE===