#25870 [NEW]: Session variables do NOT work as expected without session_register()
| From: | memoimyself at yahoo dot com dot br | Date: | Tue, 14 Oct 2003 18:03:48 +0000 |
| Subject: | #25870 [NEW]: Session variables do NOT work as expected without session_register() | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-48999@lists.php.net to get a copy of this message | ||
From: memoimyself at yahoo dot com dot br
Operating system: Windows 2000 SP 4
PHP version: 4.3.3
PHP Bug Type: Session related
Bug description: Session variables do NOT work as expected without session_register()
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 bug report at http://bugs.php.net/?id=25870&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=25870&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=25870&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=25870&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=25870&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=25870&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=25870&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=25870&r=support
Expected behavior: http://bugs.php.net/fix.php?id=25870&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=25870&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=25870&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=25870&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=25870&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=25870&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=25870&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=25870&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=25870&r=float