php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #17069 Session & register_globals
Submitted: 2002-05-07 05:57 UTC Modified: 2002-10-03 22:41 UTC
Votes:3
Avg. Score:5.0 ± 0.0
Reproduced:3 of 3 (100.0%)
Same Version:2 (66.7%)
Same OS:2 (66.7%)
From: drnix at aha dot ru Assigned:
Status: Closed Package: Documentation problem
PHP Version: 4.1.2 OS: Windows 2000
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: drnix at aha dot ru
New email:
PHP Version: OS:

 

 [2002-05-07 05:57 UTC] drnix at aha dot ru
This code don't work properly:
----
<?php
session_start();
if (get_cfg_var('register_globals')) {
  if (!session_is_registered('step')) { 
    session_register("step");
    $step = 0;
  }
} else {
  if (!isset($_SESSION['step'])) {
    $_SESSION['step'] = 0;
  }
}
echo $_SESSION['step']++;
echo session_encode();
?>
<br><A HREF="<?php echo $_SERVER['PHP_SELF']?>">Reload</A>
----

If register_globals is On, reload will increment counter. 

If register_globals is Off, session will "read_only" like. 
It create session file with zero length. Any write not occurs. 
session_encode() returns a empty string;


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-05-30 06:46 UTC] mfischer@php.net
It's a mis-assumption that session_register()ing a global variable put's it into $_SESSION in the same request. 

Sessions never behaved this way.

The documentation should be clearer on this, reclassifying.
 [2002-08-23 08:04 UTC] mfischer@php.net
I'm wondering if this is actually still true. Can anyone confirm this?
 [2002-10-03 22:41 UTC] iliaa@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Sep 19 14:01:28 2024 UTC