|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2008-02-05 23:02 UTC] galaxy dot mipt at gmail dot com
Description:
------------
Looks like session data gets corrupted at serialization step if one attempts to store certain variables in session, namely HTTP_SESSION_VARS. As far as I understand it is a desired behavior that var with that name doesn't get saved in session (still it is *really* worth mentioning that in documentation on sessions), but it seems to have some side effects on successive variables passed to the session.
Reproduce code:
---------------
session_start();
print '<pre>';
print_r($_SESSION);
print '</pre>';
$_SESSION['qwerty'] = 1;
$_SESSION['HTTP_SESSION_VARS'] = 2;
$_SESSION['ABC'] = 'qqq';
Expected result:
----------------
First call:
Array
(
)
Later calls:
Array
(
[qwerty] => 1
[ABC] => qqq
)
Actual result:
--------------
First call:
Array
(
)
Later calls:
Array
(
[qwerty] => 1
[i:2;ABC] => qqq
)
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Dec 06 21:00:01 2025 UTC |
This directive became available in PHP 5.0.0 and was dropped in PHP 6.0.0. Turning them on seems to work as expected. No corruption on 5.3.0beta2-dev (Build Date Feb 10 2009 12:47:18) What type of session.serialize_handler are you using? I get the error in the beta with php, but not with wddx. With php_binary I get a load of warnings. Warning: session_start() [function.session-start.html]: Trying to destroy uninitialized session in D:\Data\Web Sites\Development\Web Reports\public_html\sess.php on line 2 Warning: session_start() [function.session-start.html]: Failed to decode session object. Session has been destroyed in D:\Data\Web Sites\Development\Web Reports\public_html\sess.php on line 2 Warning: session_start() [function.session-start.html]: Cannot send session cache limiter - headers already sent (output started at D:\Data\Web Sites\Development\Web Reports\public_html\sess.php:2) in D:\Data\Web Sites\Development\Web Reports\public_html\sess.php on line 2 Array ( [qwerty] => 1 ) Array ( [qwerty] => 1 )Yeah, php handler gives bug, php_binary - warnings, wddx gives this: Array ( [qwerty] => 1 [HTTP_SESSION_VARS] => 2 [ABC] => qqq ) PHP 5.2.95.2.9-2 Windows NT DYPA 5.1 build 2600 1st: Array ( ) 2nd: Array ( [qwerty] => 1 [i:2;ABC] => qqq )