For Programmers: Free Programming Magazines  


Home > Archive > PHP Documentation > May 2006 > #37629 [Com]: 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 [Com]: register_globals makes $_SESSION misbehave
judas dot iscariote at gmail dot com

2006-05-30, 7:01 pm

ID: 37629
Comment by: judas dot iscariote at gmail dot com
Reported By: phpbugs at asystance dot nl
Status: Open
Bug Type: Documentation problem
Operating System: Windows XP / Debian Linux
PHP Version: 4.4.2
New Comment:

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.


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

[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