|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37444 Session not saved if $_SESSION array assigned as a whole array
Submitted: 2006-05-15 08:09 UTC Modified: 2006-05-15 10:48 UTC
From: grueff at libero dot it Assigned:
Status: Not a bug Package: Session related
PHP Version: 5.1.4 OS: Win XP
Private report: No CVE-ID: None
 [2006-05-15 08:09 UTC] grueff at libero dot it
If i put values in $_SESSION array by inserting them as array elements such as this:


All does function ok; but if i prepare a whole array of values and put it in the session such as this:


NOTHING gets written in the session, and any subsequest pages loading the session will get an empty session array.

Reproduce code:
This writes the session

This tries to read the session:

Expected result:
Output the content of $tize array!

Actual result:
Outputs an empty array!


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-05-15 08:23 UTC]
This is expected behaviour.
_SESSION arrays looses its magic characteristics when you overwrite it with another array.
 [2006-05-15 10:48 UTC] grueff at libero dot it
Excuse me, but why it is expected?

And why this is not mentioned in any part of the documentation?

And, again, why this was not the case in previous PHP versions?
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Mon May 23 15:05:45 2022 UTC