php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #12236 session_start() inside a function destroys reference to $HTTP_SESSION_VARS
Submitted: 2001-07-18 16:08 UTC Modified: 2001-11-24 19:41 UTC
From: b dot erdmann at 4commerce dot de Assigned:
Status: Closed Package: Session related
PHP Version: 4.0.6 OS: any
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: b dot erdmann at 4commerce dot de
New email:
PHP Version: OS:

 

 [2001-07-18 16:08 UTC] b dot erdmann at 4commerce dot de
The following code doesn't work

<?php
  function start_session() {
    global $HTTP_SESSION_VARS;
    session_start();
    echo $HTTP_SESSION_VARS["testvar"];
  }
  start_session();
?>

while this one does

<?php
  function start_session() {
    session_start();
    global $HTTP_SESSION_VARS;
    echo $HTTP_SESSION_VARS["testvar"];
  }
  start_session();
?>
Obviosly after session_start() $HTTP_SESSION_VARS is not
global any more.

(register_globals Off)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-11-24 19:41 UTC] sniper@php.net
This problem will be gone in PHP 4.1.0 (and more probs are 
fixed for 4.2.0). In PHP 4.1 we have introduced new TRUE
global variables and one of them is:

$_SESSION (same as $HTTP_SESSION_VARS but is true global)

--Jani

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Oct 31 23:01:28 2024 UTC