Re: Variable names and SESSION names?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 09.04.2021 at 00:18, Ashley Sheridan wrote:

> On 08/04/2021 22:03, Tedd Sperling wrote:
>> Hi Gang:
>>
>> It was reported to me that PHP has problems occasionally with variable
>> names being the same as SESSION variable names — is that true?
>>
>> For example, could the following present a problem:
>>
>> $color = “red”;
>> $_SESSION[‘color’] = $color;
>>
>> I had that happen well over a decade ago, but nothing recent. How
>> about you guys?
>>
>> Thanks,
>>
>> Tedd
>>
>> Tedd Sperling
>> tedd@xxxxxxxxxxxx
>>
> I think that would only be a problem if register_globals was set to true
> (which it isn't by default, and shouldn't ever really be these days), as
> that setting basically sets the normal super globals ($_REQUEST, $_GET,
> $_POST, $_SESSION, etc) values as global variables themselves. So
> $_SESSION['foo'] also becomes available as $foo.

The good news is that register_globals is removed as of PHP 5.4.0.

--
Christoph M. Becker




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux