php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28080 session_start defect and not in sync with $_SESSION
Submitted: 2004-04-20 18:51 UTC Modified: 2004-04-20 22:30 UTC
From: revealator at myrealbox dot com Assigned:
Status: Not a bug Package: Session related
PHP Version: 4.3.4 OS: Windows98
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: revealator at myrealbox dot com
New email:
PHP Version: OS:

 

 [2004-04-20 18:51 UTC] revealator at myrealbox dot com
Description:
------------
The constant SID is not defined if a session is started with $_SESSION['bla'] = 'dummy'.

So you have to call session_start to get the SID constant.

But a call to session_start will kill a session that was already started with $_SESSION['bla'] ='dummy'.

Reproduce code:
---------------
// register globals is off
error_reporting(E_NOTICE);
$_SESSION['dummy'] = 'started';
echo '<pre>';
echo "session data before call to session_start:\n";
print_r($_SESSION);

echo "SID is defined before call to session_start? "  . (defined('SID') == true?'yes':'no');
echo "\n";

session_start();
echo "SID is defined after call to session start? "  . (defined('SID') == true?'yes':'no');
echo "\n";

echo "session data after call to session_start:\n";
print_r($_SESSION);
exit;


Expected result:
----------------
SID should be defined when a session is started with $_SESSION and session_start should handle the call to itself as if it was called twice when $_SESSION is used.

Actual result:
--------------
session data before call to session_start:
Array
(
    [dummy] => started
)
SID is defined before call to session_start? no
SID is defined after call to session start? yes
session data after call to session_start:
Array
(
)



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-04-20 22:30 UTC] derick@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

This is perfectly normal.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Jul 12 10:01:33 2025 UTC