Re: Register globals and ini_set
| From: | Richard Lynch | Date: | Mon, 11 Jul 2005 02:25:18 +0000 |
| Subject: | Re: Register globals and ini_set | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-218413@lists.php.net to get a copy of this message | ||
On Fri, July 8, 2005 7:50 am, Terry Romine said:
You *ARE* doing session_start at the top of each page, right?...
Ya gotta do that.
> I was setting the $_SESSION by:
> $_SESSION['var_name'] = "this";
> or
> $my_local = "this";
> $_SESSION['var_name'] = $my_local;
There *WAS* a bug in PHP [mumble] (4.1.10???) where the $_SESSION data was
"leaking" out to PHP as a "string reference" (never mind PHP has no such
data type).
You could detect it by dumping out $_SESSION and you would see an & in
front of all the strings.
So if you later did:
$var_name = '';
Then your $_SESSION['var_name'] was *ALSO* getting set to ''
> I had stopped using session_register() some time back.
>
> "Sporatically" meaning that some of my variables are working fine, while
> others seem to become empty when referenced by a later script. These
> scripts were working fine on the older PHP version. I'm sure it's just a
> quick determination as to what to change, and then I can do a global
> update across the site. There are about 20-30 websites that this affects,
> so you can see my frustration in trying to do this by bits and pieces. I
> had done a test file like this:
>
> test1.php:
> <?php
> $_SESSION['check'] = "test 1";
> echo($_SESSION['check']);
> ?>
> <a href='test2.php'>Click</a>
>
> and
> test2.php:
> <?php
> echo($_SESSION['check']);
> ?>
> test1.php displays "test1" but test2.php displays nothing.
Looks to me more like the more mundane:
You didn't do session_start() at the beginning of both scripts.
Go to Jail. Do not collect $400.
--
Like Music?
http://l-i-e.com/artists.htm