note 82128 added to ref.session
| From: | awe at osu1 dot php dot net | Date: | Fri, 28 Mar 2008 09:20:15 +0000 |
| Subject: | note 82128 added to ref.session | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-137664@lists.php.net to get a copy of this message | ||
The note below from 04-Dec-2006 09:59 about lost session information is still valid! I have just
moved hosting and have this bug which previously didn't affect my site. PHP version 5.2.4.
What I've found out is that inside a local function this bug doesn't happen (probably due
to variable scope).
So this is BUGGY (session variable content will be lost):
<?php
$myVar = 1234;
$_SESSION['myVar'] = $myVar;
?>
But this would work:
<?php
function foo(){
$myVar = 1234;
$_SESSION['myVar'] = $myVar;
}
foo();
?>
----
Server IP: 82.160.94.10
Probable Submitter: 89.1.11.181
----
Manual Page -- http://www.php.net/manual/en/ref.session.php
Edit -- https://master.php.net/note/edit/82128
Del: integrated -- https://master.php.net/note/delete/82128/integrated
Del: useless -- https://master.php.net/note/delete/82128/useless
Del: bad code -- https://master.php.net/note/delete/82128/bad+code
Del: spam -- https://master.php.net/note/delete/82128/spam
Del: non-english -- https://master.php.net/note/delete/82128/non-english
Del: in docs -- https://master.php.net/note/delete/82128/in+docs
Del: other reasons-- https://master.php.net/note/delete/82128
Reject -- https://master.php.net/note/reject/82128
Search -- https://master.php.net/manage/user-notes.php