Bug #16273: $_SESSION won't work when register_globals is OFF!
| From: | anarres at gmx dot net | Date: | Tue, 26 Mar 2002 00:53:53 +0000 |
| Subject: | Bug #16273: $_SESSION won't work when register_globals is OFF! | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-3334@lists.php.net to get a copy of this message | ||
From: anarres@gmx.net
Operating system: Windows 98 SE German
PHP version: 4.1.2
PHP Bug Type: Session related
Bug description: $_SESSION won't work when register_globals is OFF!
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
--
Edit bug report at http://bugs.php.net/?id=16273&edit=1
--
Fixed in CVS: http://bugs.php.net/fix.php?id=16273&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=16273&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=16273&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=16273&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=16273&r=support
Expected behavior: http://bugs.php.net/fix.php?id=16273&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=16273&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=16273&r=submittedtwice