php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #34780 Serialize() and Sessions does not work properly
Submitted: 2005-10-07 16:02 UTC Modified: 2005-10-08 01:00 UTC
From: pavel_bogdanovic at yahoo dot de Assigned:
Status: Not a bug Package: Session related
PHP Version: 5.0.5 OS: winxp
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: pavel_bogdanovic at yahoo dot de
New email:
PHP Version: OS:

 

 [2005-10-07 16:02 UTC] 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";}


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-10-07 19:07 UTC] 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-08 01:00 UTC] pavel_bogdanovic at yahoo dot de
wow, sorry for submitting no bug!
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Apr 29 15:01:31 2024 UTC