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
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: 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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Mon Apr 29 11:01:32 2024 UTC