Re: Completely stumped (still) [message #185107 is a reply to message #185103] |
Wed, 26 February 2014 21:20 |
Thomas 'PointedEars'
Messages: 701 Registered: October 2010
Karma:
|
Senior Member |
|
|
Christoph Michael Becker wrote:
> Thomas 'PointedEars' Lahn wrote:
>> Christoph Michael Becker wrote:
>>> Thomas 'PointedEars' Lahn wrote:
>>>> Christoph Michael Becker wrote:
>>>> > Thomas 'PointedEars' Lahn wrote:
>>>> >> $*_VARS were first.
>>>> >
>>>> > According to the manual $HTTP_SESSION_VARS and $_SESSION are different
>>>> > variables, anyway.[1]
>>>> >
>>>> > [1] <http://www.php.net/manual/en/reserved.variables.session.php>
>>>>
>>>> $_SESSION is a superglobal; $HTTP_SESSION_VARS is/was not (i.e., it
>>>> needs to be declared a global if it is to be accessed from local
>>>> context). But I am quite certain that when both were still supported,
>>>> if you modified one, you modified the other (I have only PHP 5.5.9 to
>>>> test with, where there is no $HTTP_SESSION_VARS anymore).
>>>
>>> The manual says:
>>>
>>> | $HTTP_SESSION_VARS contains the same initial information, but is not
>>> | a superglobal. (Note that $HTTP_SESSION_VARS and $_SESSION are
>>> | different variables and that PHP handles them as such)
>>
>> I *know* what the manual says. That does not prove anything.
>
> Testing on a single system might not prove much more, either. Anyway, I
> tested the following script on PHP 5.2.13 (FCGI, register_globals=On or
> Off, register_long_arrays=On):
>
> <?php
>
> session_start();
> var_dump($HTTP_SESSION_VARS["foo"]);
> $_SESSION["foo"] = "bar";
> var_dump($HTTP_SESSION_VARS["foo"]);
>
> The result really surprised me:
>
> string(3) "bar" string(3) "bar"
>
> The output is the same, if I switch $HTTP_SESSION_VARS and $_SESSION. A
> similar test regarding $_GET and $HTTP_GET_VARS showed the documented
> behavior, by the way.
>
> It seems that is a documentation bug.
ACK.
> However, I suppose that's mostly rrelevant now, because the bug tracker is
> concerned with PHP 5.4-5.6, and says wrt. earlier versions: "upgrade
> first". But since PHP 5.4 register_long_arrays has been removed, so I
> conclude that the $HTTP_*_VARS have been removed also,
They have been removed indeed, as you can see in my PHP 5.5 test results.
I found it curiouser, though, that you can use “global” outside a function.
And not only that (which makes some sense as the file can be included), but
that apparently you can actually *declare* a global variable in PHP this way
(in my case, the previously non-existing $HTTP_SESSION_VARS).
> in which case their documentation is even more in error, because it states
> they are deprecated, but doesn't mention that they have been removed.
> Now I am completely stumped.
ACK.
PointedEars
--
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee
|
|
|