From d46dab70e8aafeeed8d6c24178d4271775cc7a1d Mon Sep 17 00:00:00 2001 From: Robert Nicholson Date: Sun, 7 Jun 2009 21:01:51 +0000 Subject: New tests for foreach loops. These were written by another member of the Projectzero team. --- tests/lang/foreachLoop.005.phpt | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 tests/lang/foreachLoop.005.phpt (limited to 'tests/lang/foreachLoop.005.phpt') diff --git a/tests/lang/foreachLoop.005.phpt b/tests/lang/foreachLoop.005.phpt new file mode 100644 index 0000000000..ae6ed3aa28 --- /dev/null +++ b/tests/lang/foreachLoop.005.phpt @@ -0,0 +1,23 @@ +--TEST-- +Foreach loop tests - modifying the array during the loop: special case. Behaviour is good since php 5.2.2. +--FILE-- +&$v){ + $a[$k] = "changed.$k"; + echo "After changing \$a directly, \$v@$k is: $v\n"; +} +//--- Expected output: +//After changing $a directly, $v@0 is: changed.0 +//After changing $a directly, $v@1 is: changed.1 +//After changing $a directly, $v@2 is: changed.2 +//--- Actual output from php.net before 5.2.2: +//After changing $a directly, $v@0 is: changed.0 +//After changing $a directly, $v@1 is: original.1 +//After changing $a directly, $v@2 is: original.2 + +?> +--EXPECT-- +After changing $a directly, $v@0 is: changed.0 +After changing $a directly, $v@1 is: changed.1 +After changing $a directly, $v@2 is: changed.2 -- cgit v1.2.1