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

From: Date: Fri, 07 Oct 2005 17:07:12 +0000
Subject: #34780 [Opn->Bgs]: Serialize() and Sessions does not work properly
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-86206@lists.php.net to get a copy of this message
ID: 34780 Updated by: johannes@php.net Reported By: pavel_bogdanovic at yahoo dot de -Status: Open +Status: Bogus Bug Type: Session related Operating System: winxp PHP Version: 5.0.5 New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [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 (#86206) next »