Bug #13579 Updated: variables deglobalized after session_register()

From: Date: Thu, 20 Dec 2001 04:08:17 +0000
Subject: Bug #13579 Updated: variables deglobalized after session_register()
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-74514@lists.php.net to get a copy of this message
ID: 13579
Updated by: yohgaki
Reported By: pesterhazy@gmx.net
Status: Open
Bug Type: Session related
Operating System: Win2k
PHP Version: 4.0.6
New Comment:

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

Previous Comments:
------------------------------------------------------------------------

[2001-10-06 16:31:21] pesterhazy@gmx.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();

------------------------------------------------------------------------



Edit this bug report at http://bugs.php.net/?id=13579&edit=1



Thread (4 messages)

« previous php.dev (#74514) next »