cvs: ZendEngine2(PHP_5_2) / zend_API.c php-src/ext/spl/tests spl_007.phpt
| From: | Johannes Schl�ter | Date: | Mon, 30 Apr 2007 19:54:41 +0000 |
| Subject: | cvs: ZendEngine2(PHP_5_2) / zend_API.c php-src/ext/spl/tests spl_007.phpt | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-5763@lists.php.net to get a copy of this message | ||
johannes Mon Apr 30 19:54:41 2007 UTC
Added files: (Branch: PHP_5_2)
/php-src/ext/spl/tests spl_007.phpt
Modified files:
/ZendEngine2 zend_API.c
Log:
- MFH Fix "f" modifier for zend_parse_parameters_ex in case of a __call call
# only affects iterator_apply() in 5_2 branch
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_API.c?r1=1.296.2.27.2.28&r2=1.296.2.27.2.29&diff_format=u
Index: ZendEngine2/zend_API.c
diff -u ZendEngine2/zend_API.c:1.296.2.27.2.28 ZendEngine2/zend_API.c:1.296.2.27.2.29
--- ZendEngine2/zend_API.c:1.296.2.27.2.28 Mon Apr 16 08:09:54 2007
+++ ZendEngine2/zend_API.c Mon Apr 30 19:54:41 2007
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_API.c,v 1.296.2.27.2.28 2007/04/16 08:09:54 dmitry Exp $ */
+/* $Id: zend_API.c,v 1.296.2.27.2.29 2007/04/30 19:54:41 johannes Exp $ */
#include "zend.h"
#include "zend_execute.h"
@@ -2361,17 +2361,24 @@
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;
}
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/spl_007.phpt?view=markup&rev=1.1
Index: php-src/ext/spl/tests/spl_007.phpt
+++ php-src/ext/spl/tests/spl_007.phpt
--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===