php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #13579 variables deglobalized after session_register()
Submitted: 2001-10-06 16:31 UTC Modified: 2002-01-07 06:31 UTC
From: pesterhazy at gmx dot net Assigned: yohgaki (profile)
Status: Closed Package: Documentation problem
PHP Version: 4.0.6 OS: Win2k
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: pesterhazy at gmx dot net
New email:
PHP Version: OS:

 

 [2001-10-06 16:31 UTC] pesterhazy at gmx dot net
the following script will print out
unset
set
the first time it is run although it should actually print 'set' twice; somehow, the variable needs to be globalized again after the session has been registered.

normal php4 setup with everything compiled-in.
php -v >> 4.0.6devel
---------------------
function test()
{
  global $glb_var;

  session_save_path("e:\\temp");
  session_start();
  session_register('glb_var');

  test2();

  print "glb_var='$glb_var'<br>";

  global $glb_var;
  print "glb_var='$glb_var'";
}

function test2()
{
  global $glb_var;

  $glb_var = 'set';
}

$glb_var = 'unset';
test();

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-12-19 23:08 UTC] yohgaki@php.net
This is half user's fault....
Can we do something to this issue?

To reporter: Could you update PHP version when you test and confirm problem exists in newer versions? Read "Reference Explained" section carefully for the reason why this is problem in your script.

http://www.php.net/manual/en/language.references.php
 [2002-01-06 22:40 UTC] yohgaki@php.net
I'll update doc so that this kind of report will not be submitted to bug database :)
 [2002-01-07 06:31 UTC] yohgaki@php.net
Doc updated
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 27 23:01:30 2024 UTC