|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #35270 copying an array no longer resets the index
Submitted: 2005-11-18 05:15 UTC Modified: 2005-11-26 01:00 UTC
From: andrej at blueshoes dot org Assigned:
Status: No Feedback Package: Arrays related
PHP Version: ? OS: windows
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2005-11-18 05:15 UTC] andrej at blueshoes dot org
the documentation for each has a caution which was true for php up to 4.3.11, but it's not for 4.4.1 anymore. 

Reproduce code:
		$array   = array('a', 'b', 'c', 'd', 'e', 'f', 'g');
		$breakAt = 3;
		while (list($key, $val) = each($array)) {
			if ($i > $breakAt) break;
		$brray = $array;
		$aCurrent = current($array);
		$bCurrent = current($brray);
    $actual   = $aCurrent;
    $expected = 'a';
    $this->assertEquals($expected, $actual, "failed? could be a good thing. check the code.");
    $actual   = $bCurrent;
    $expected = 'f';
    $this->assertEquals($expected, $actual, "failed? could be a good thing.");

Expected result:
a or f

Actual result:
a or f


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-11-18 09:40 UTC]
There is no such version as "Irrelevant".
Or did you really try it with *ALL* versions since 1.0.0 ?
 [2005-11-18 10:07 UTC]
This was originally a Documentation problem so Irrelevant was filled by our bug system. I guess it's 4.4.1.
 [2005-11-26 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Jun 14 07:01:49 2024 UTC