For Programmers: Free Programming Magazines  


Home > Archive > PHP Documentation > October 2006 > #37629 [Opn->Bgs]: register_globals makes $_SESSION misbehave









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author #37629 [Opn->Bgs]: register_globals makes $_SESSION misbehave
sesser@php.net

2006-10-23, 7:58 am

ID: 37629
Updated by: sesser@php.net
Reported By: phpbugs at asystance dot nl
-Status: Open
+Status: Bogus
Bug Type: Documentation problem
Operating System: Windows XP / Debian Linux
PHP Version: 4.4.2
New Comment:

Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. Due to the volume
of reports we can not explain in detail here why your report is not
a bug. The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

It is only documented that on session_start() the content of _SESSION
will be globalized. Or when you use session_register().

It is nowhere mentioned that inserting something into _SESSION
magically creates a global variable or a reference to it.




Previous Comments:
------------------------------------------------------------------------

[2006-05-30 17:08:04] judas dot iscariote at gmail dot com

this is a "misfeature", and I don't think It would be fixed at all in
4.4 doing so, will break a lot code...

it is fixed in php6, since register_globals is gone.

Just Do not use register_globals.

------------------------------------------------------------------------

[2006-05-29 15:52:26] phpbugs at asystance dot nl

changed version

------------------------------------------------------------------------

[2006-05-29 15:49:32] phpbugs at asystance dot nl

Description:
------------
When register_globals = On (I know this is legacy), $_SESSION behaves
differently than the other superglobals and this (mis)behaviour is not
documented.

This is actually a duplicate of (or maybe just related to) bug #25110.
sniper@php.net calls this behaviour a "feature". I strongly disagree.

What we should agree on is that it's undocumented and unexpected.
Neither the documentation on register_globals nor the documentation on
superglobals mentions this. It also only works with $_SESSION (and not
with other superglobals), so the behaviour is very unexpected.

I tested this with two debian installations (4.4.2-1+b1 on Apache
2.0.55 and 4.3.10-16.8 on apache 1.3.33) and the latest Windows zip
package 4.4.2 on Apache2.

Reproduce code:
---------------
<?php
session_start();
$_SESSION['var'] = 'hello';
$var = 'again';
echo $_SESSION['var'];
?>


Expected result:
----------------
Output is 'hello'

Actual result:
--------------
Output is 'again'


------------------------------------------------------------------------


--
Edit this bug report at http://bugs.php.net/?id=37629&edit=1
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com