php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #33811 session file is not written under certain circumstances
Submitted: 2005-07-21 20:41 UTC Modified: 2005-12-11 14:49 UTC
From: hartmann at mayflower dot de Assigned:
Status: Not a bug Package: Session related
PHP Version: 5.0.4 OS: Windows XP
Private report: No CVE-ID: None
 [2005-07-21 20:41 UTC] hartmann at mayflower dot de
Description:
------------
If register_globals and register_long_arrays is Off (as in php.ini-recommended), under certain circumstances _SESSION data does not get saved.

Reproduce code:
---------------
http://thinkforge.org/snippet/detail.php?type=snippet&id=11

Expected result:
----------------
$_SESSION['i'] is incremented with every request

Actual result:
--------------
$_SESSION[i] does not get incremented, session file is 0 bytes.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-07-21 20:47 UTC] tony2001@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

It happens *exactly* because register_globals is Off and that's well expected.
 [2005-07-21 23:41 UTC] hartmann at mayflower dot de
Please read my bug report again. The session is started, and there is data in $_SESSION - but the session file is 0 bytes.
The bug does not happen if register_globals is off and register_long_arrays is set to on.
 [2005-07-22 00:03 UTC] hartmann at mayflower dot de
Nicer reproduction code: 
<?php 
// set register_globals and register_long_arrays to off to reproduce 
session_start();
if (!isset($_SESSION['i'])) $_SESSION['i'] = 0; 
if ((ini_get('register_globals') != 'On')) {
    foreach ($_SESSION as $key=>$nil) {
        $GLOBALS[$key] =& $_SESSION[$key];
    }
}
$i++; 
echo $i; 
?>
 [2005-12-11 14:49 UTC] sniper@php.net
Never EVER do anything like that! This is expected to fail if you try outsmarting the session engine.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 22:01:29 2024 UTC