php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #46535 arrays internal pointer saved in function
Submitted: 2008-11-10 13:34 UTC Modified: 2009-09-03 06:49 UTC
From: max_m at eyelinkmedia dot com Assigned:
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS: MacOs X
Private report: No CVE-ID: None
 [2008-11-10 13:34 UTC] max_m at eyelinkmedia dot com
Description:
------------
php-manual "Backward Incompatible Changes" did not describe changes with arrays internal pointers.
If I passed array to some function call_func($some_array)
internal pointer of $some_array reseted in php4, but saved in php5

Reproduce code:
---------------
$a = array (
  'first' => 1,
  'second' => 2,
);

function test($a) {
    while (list($k, $v)=each($a))
        echo $k."\n";
}

next($a);
test($a);

Expected result:
----------------
first
second

Or make in documented in "PHP: Backward Incompatible Changes"

Actual result:
--------------
In php4:
first
second

php5:
second


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-09-03 06:49 UTC] svn@php.net
Automatic comment from SVN on behalf of torben
Revision: http://svn.php.net/viewvc/?view=revision&revision=287977
Log: Noted that the array pointer is no longer reset for array accesses
made within a function when the array has been passed to the function.
Addresses bug #46535.
--This line,
and those below, will be ignored--

M    migration5.xml
 [2009-09-03 06:49 UTC] torben@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.


 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Wed Jun 17 00:00:02 2026 UTC