|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-01-26 00:57 UTC] jani@php.net
[2008-02-02 01:00 UTC] php-bugs at lists dot php dot net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Dec 02 06:00:01 2025 UTC |
Description: ------------ The function which is supposed to get a copy of the original array and never mess the original array magically changed the internal pointer of the original array. Noticed it doesn't change the pointer if foreach just loop though the array itself (this seems to be fixed in #40705). However, as it is in the repro code, I loop though a subelement of the array, it still changes the pointer. Reproduce code: --------------- <?php function a($arr) { foreach($arr['k'] as $r) { } } $arr = array( 'k' => array(1) ); a($arr); var_dump(current($arr['k'])); Expected result: ---------------- int(1) Actual result: -------------- bool(false)