From:             Henry at huis-stijl dot nl
Operating system: Apache/2.0.52 (CentOS)
PHP version:      5.2.9
PHP Bug Type:     Scripting Engine problem
Bug description:  Arry_shift with SESSION

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 bug report at http://bugs.php.net/?id=47623&edit=1
-- 
Try a CVS snapshot (PHP 5.2):        
http://bugs.php.net/fix.php?id=47623&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):        
http://bugs.php.net/fix.php?id=47623&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):        
http://bugs.php.net/fix.php?id=47623&r=trysnapshot60
Fixed in CVS:                        
http://bugs.php.net/fix.php?id=47623&r=fixedcvs
Fixed in CVS and need be documented: 
http://bugs.php.net/fix.php?id=47623&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=47623&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=47623&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=47623&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=47623&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=47623&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=47623&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=47623&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=47623&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=47623&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=47623&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=47623&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=47623&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=47623&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=47623&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=47623&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=47623&r=mysqlcfg

Reply via email to