php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #16273 $_SESSION won't work when register_globals is OFF!
Submitted: 2002-03-25 19:53 UTC Modified: 2002-04-10 19:15 UTC
From: anarres at gmx dot net Assigned:
Status: Closed Package: Session related
PHP Version: 4.1.2 OS: Windows 98 SE German
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
23 - 16 = ?
Subscribe to this entry?

 
 [2002-03-25 19:53 UTC] anarres at gmx dot net
Two days ago I installed PHP Version 4.1.2 as CGI on a Win98SE platform with Apache 1.3.20 running as server. I used the php.ini-recommended with register_globals turned OFF and made only minor changes concerning directories and error-display. Migrating my old scripts to the new settings I found that the session management with the superglobal $_SESSION would not work: the session file was created in my session directory (session.save_path=c:\tmp) BUT no session variables were stored in it.

Here's a pair of scripts to illustrate:

session_1.php:
        <?php
            session_start();
            $_SESSION['text']="Hallo!";
            echo '<a href="session_2.php">session_2.php</a>';
        ?>

session_2.php:
        <?php
            session_start();
            echo $_SESSION['text'];
        ?>

On activating the link to session_2.php, the following errormessage is displayed:

        Warning: Undefined index: text in session_2.php on line 3

(Using $HTTP_SESSION_VARS['text'] instead of $_SESSION['text'] leads to the same result.)

However, turning register_globals ON and using global variables with session_register(), session_unregister() and session_is_registered() works fine. But that's not really the point of php.ini-recommended, is it? ;-)-:

After spending many hours checking my setup, reading the manual and several faqs and finally receiving feedback from other users who have the same problem on the german PHP-mailinglist php@phpcenter.de and not finding it  this bug in your list of reported bugs, I decided to report it. I also thought that this is a rather major problem, since register_globals is to be turned off by default in upcoming versions. Please contact me if you need any additional information - this is the first time I am reporting a bug.

Thanx 4 your great work,
Robert

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-03-25 20:15 UTC] anarres at gmx dot net
Two days ago I installed PHP Version 4.1.2 as CGI on a Win98SE platform
   with Apache 1.3.20 running as server. I used the php.ini-recommended
   with register_globals turned OFF and made only minor changes concerning
   directories and error-display. Migrating my old scripts to the new
   settings I found that the session management with the superglobal
   $_SESSION would not work: the session file was created in my session
   directory (session.save_path=c:\tmp) BUT no session variables were
   stored in it.

   Here's a pair of scripts to illustrate:

   session_1.php:
           <?php
               session_start();
               $_SESSION['text']="Hallo!";
               echo '<a href="session_2.php">session_2.php</a>';
           ?>

   session_2.php:
           <?php
               session_start();
               echo $_SESSION['text'];
           ?>

   On activating the link to session_2.php, the following errormessage is
   displayed:

           Warning: Undefined index: text in session_2.php on line 3

   (Using $HTTP_SESSION_VARS['text'] instead of $_SESSION['text'] leads to
   the same result.)

   However, turning register_globals ON and using global variables with
   session_register(), session_unregister() and session_is_registered()
   works fine. But that's not really the point of php.ini-recommended, is
   it? ;-)-:

   After spending many hours checking my setup, reading the manual and
   several faqs and finally receiving feedback from other users who have
   the same problem on the german PHP-mailinglist php@phpcenter.de and not
   finding it  this bug in your list of reported bugs, I decided to report
   it. I also thought that this is a rather major problem, since
   register_globals is to be turned off by default in upcoming versions.
   Please contact me if you need any additional information - this is the
   first time I am reporting a bug.

   Thanx 4 your great work,
   Robert
 [2002-04-10 19:15 UTC] sniper@php.net
This bug has been fixed in CVS.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 08:01:27 2024 UTC