dmitry Fri Oct 28 06:06:54 2005 EDT
Modified files:
/php-src/ext/standard/tests/array bug34982.phpt
Log:
Fixed bug #34982 (array_walk_recursive() modifies elements outside function
scope)
http://cvs.php.net/diff.php/php-src/ext/standard/tests/array/bug34982.phpt?r1=1.1&r2=1.2&ty=u
Index: php-src/ext/standard/tests/array/bug34982.phpt
diff -u /dev/null php-src/ext/standard/tests/array/bug34982.phpt:1.2
--- /dev/null Fri Oct 28 06:06:54 2005
+++ php-src/ext/standard/tests/array/bug34982.phpt Fri Oct 28 06:06:53 2005
@@ -0,0 +1,40 @@
+--TEST--
+Bug #34982 array_walk_recursive() modifies elements outside function scope
+--FILE--
+<?php
+$ar = array(
+ 'element 1',
+ array('subelement1')
+ );
+
+func($ar);
+print_r($ar);
+
+function func($a) {
+ array_walk_recursive($a, 'apply');
+ print_r($a);
+}
+
+function apply(&$input, $key) {
+ $input = 'changed';
+}
+?>
+--EXPECT--
+Array
+(
+ [0] => changed
+ [1] => Array
+ (
+ [0] => changed
+ )
+
+)
+Array
+(
+ [0] => element 1
+ [1] => Array
+ (
+ [0] => subelement1
+ )
+
+)
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php