ID:               47623
 Updated by:       j...@php.net
-Summary:          Arry_shift with SESSION
 Reported By:      Henry at huis-stijl dot nl
-Status:           Open
+Status:           Feedback
 Bug Type:         Scripting Engine problem
 Operating System: Apache/2.0.52 (CentOS)
 PHP Version:      5.2.9
 New Comment:

Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.




Previous Comments:
------------------------------------------------------------------------

[2009-03-11 12:56:34] Henry at huis-stijl dot nl

Description:
------------
Script was working perfectly on PHP 4 when updated to PHP5.2.9 I found
an error. I was filling a array in the session and looped it with
array_shift until the arry was empty. 
This loop kept giving me the first value but did not erased it from te
original arry.

Reproduce code:
---------------
$row = array_shift(@$_SESSION['villas']);

Expected result:
----------------
1. $row getting the first element from $_SESSION['villas']
2. $_SESSION['villas'] to get lost the first element.


Actual result:
--------------
1. $row getting the first element from $_SESSION['villas']
2. $_SESSION['villas'] did not lost the first element and was
unchanged


I cann bypass this failure by using:
$arr_temp = @$_SESSION['villas'];
$row = array_shift($arr_temp);
$_SESSION['villas'] = $arr_temp;
unset($arr_temp);




------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=47623&edit=1

Reply via email to