php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #5329 session variables are always empty when register_globals=off
Submitted: 2000-07-02 14:07 UTC Modified: 2000-07-02 14:55 UTC
From: mn at altern dot org Assigned:
Status: Closed Package: Session related
PHP Version: 4.0.1pl2 OS: Debian GNU/Linux 2.2 kernel 2.2
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 this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: mn at altern dot org
New email:
PHP Version: OS:

 

 [2000-07-02 14:07 UTC] mn at altern dot org
When register_globals = Off (as recommended in php.ini-optimized)
session variables get registered in $HTTP_SESSION_VARS but their
value appears to be always empty.

-- file session-test.php --
<?php
session_start();
$foo = "foo value";
session_register("foo");
session_register("bar");
$bar = "bar value";
print("<html><a href='session-test-2.php'>Go ahead.</a></html>");
?>

-- file session-test-2.php --
<?php
session_start();
$isFoo = session_is_registered("foo") ? "is" : "is <b>not</b>";
$isBar = session_is_registered("bar") ? "is" : "is <b>not</b>";

print("
<html>
Variable \$foo $isFoo registered. Its value is \"${HTTP_SESSION_VARS['foo']}\".<br>
Variable \$bar $isBar registered. Its value is \"${HTTP_SESSION_VARS['bar']}\".
</html>
");
?>

Results:
-- with register_globals = on
Variable $foo is registered. Its value is "foo value".
Variable $bar is registered. Its value is "bar value".

-- with register_globals = off
Variable $foo is registered. Its value is "".
Variable $bar is registered. Its value is "".

I've noticed this behaviour in 4.0.0 and it persist in 4.0.1pl2.

My configure options: --with-apxs --with-mysql=/usr --disable-xml --disable-posix --disable-debug

My ini file: the php.ini-optimized

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-07-02 14:55 UTC] sli at cvs dot php dot net
Please use 
$HTTP_SESSION_VARS["foo"]="something"; 
as described in the documentation (http://snaps.php.net/manual/en/html/ref.session.html).
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 19:01:28 2024 UTC