#25870 [Opn]: Session variables do NOT work as expected without session_register()
| From: | memoimyself at yahoo dot com dot br | Date: | Tue, 14 Oct 2003 18:27:17 +0000 |
| Subject: | #25870 [Opn]: Session variables do NOT work as expected without session_register() | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-49003@lists.php.net to get a copy of this message | ||
ID: 25870
User updated by: memoimyself at yahoo dot com dot br
Reported By: memoimyself at yahoo dot com dot br
Status: Open
Bug Type: Session related
Operating System: Windows 2000 SP 4
PHP Version: 4.3.3
New Comment:
Using Apache 2.0.46 and PHP as an Apache module (as opposed to CGI).
Previous Comments:
------------------------------------------------------------------------
[2003-10-14 14:03:48] memoimyself at yahoo dot com dot br
Description:
------------
I read in the manual that the use of session_register() is deprecated
and that session variables should now be registered simply by creating,
and assigning a value to, a member of the $_SESSION array.
Well, try as I may, I just cannot register session variables without
using session_register(). If, however, I use session_register() before
assigning a value to the new session variable via $_SESSION['x'],
everything works fine.
Reproduce code:
---------------
// PAGE A (start.php):
<?php
session_start();
$_SESSION['test'] = 'my test';
?>
/*******/
// PAGE B (test.php, called after start.php, obviously):
<?php
session_start();
print $_SESSION['test'];
?>
Expected result:
----------------
OUTPUT TO SCREEN:
my test
Actual result:
--------------
OUTPUT TO SCREEN:
Notice: Undefined index: test in D:\htdocs\Test\session\test.php on
line 3
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=25870&edit=1