#34780 [Bgs]: Serialize() and Sessions does not work properly

From: Date: Fri, 07 Oct 2005 23:00:27 +0000
Subject: #34780 [Bgs]: Serialize() and Sessions does not work properly
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-86223@lists.php.net to get a copy of this message
ID: 34780 User updated by: pavel_bogdanovic at yahoo dot de Reported By: pavel_bogdanovic at yahoo dot de Status: Bogus Bug Type: Session related Operating System: winxp PHP Version: 5.0.5 New Comment: wow, sorry for submitting no bug! Previous Comments: ------------------------------------------------------------------------ [2005-10-07 19:07:11] johannes@php.net Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php Check your register_globals setting. If on $_SESSION['arr'] and $arr refer to the same variable. ------------------------------------------------------------------------ [2005-10-07 16:02:49] pavel_bogdanovic at yahoo dot de Description: ------------ Situation: The session array key is the same like the var name. After serialize() the argument is also serialized. Reproduce code: --------------- <?php session_start(); $a[] = 'A'; $a[] = 'B'; $_SESSION['arr'] = $a; echo '<pre>'; print_r($_SESSION['arr']); $arr = serialize($_SESSION['arr']); print_r($_SESSION['arr']); echo '<br/>'; print_r($arr); ?> Expected result: ---------------- Array ( [0] => A [1] => B ) Array ( [0] => A [1] => B ) a:2:{i:0;s:1:"A";i:1;s:1:"B";} Actual result: -------------- Array ( [0] => A [1] => B ) a:2:{i:0;s:1:"A";i:1;s:1:"B";} a:2:{i:0;s:1:"A";i:1;s:1:"B";} ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=34780&edit=1

« previous php.bugs (#86223) next »