com php-src: Add test-case from bug #55157: ext/spl/tests/bug 55157_variation.phpt
| From: | Nikita Popov | Date: | Thu, 02 Mar 2017 11:22:48 +0000 |
| Subject: | com php-src: Add test-case from bug #55157: ext/spl/tests/bug 55157_variation.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-97214@lists.php.net to get a copy of this message | ||
Commit: 4ab097eba15d03f6b639155f9ac4208bbb54ea52
Author: Eric Poe <eric.poe@gmail.com> Fri, 3 Feb 2017 21:56:18 -0500
Committer: Nikita Popov <nikita.ppv@gmail.com> Thu, 2 Mar 2017 12:22:48 +0100
Parents: 5cdfa46d3f79636a0243a6d3250c8ac33cce1431
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=4ab097eba15d03f6b639155f9ac4208bbb54ea52
Log:
Add test-case from bug #55157
The issue itself is not fixed, this is just a workaround.
Bugs:
https://bugs.php.net/55157
Changed paths:
A ext/spl/tests/bug55157_variation.phpt
Diff:
diff --git a/ext/spl/tests/bug55157_variation.phpt b/ext/spl/tests/bug55157_variation.phpt
new file mode 100644
index 0000000..762caa8
--- /dev/null
+++ b/ext/spl/tests/bug55157_variation.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Bug #55157: ArrayIterator always skips the second element in the array when calling offsetUnset()
+--DESCRIPTION--
+One of the test cases from bug #55157. This is a workaround around the problem that has worked
+since PHP 5.0.4.
+--FILE--
+<?php
+$nums = range(0, 3);
+$numIt = new ArrayIterator($nums);
+
+for ($numIt->rewind(); $numIt->valid();) {
+ echo "{$numIt->key()} => {$numIt->current()}\n";
+ $numIt->offsetUnset($numIt->key());
+}
+?>
+--EXPECT--
+0 => 0
+1 => 1
+2 => 2
+3 => 3