php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26047 Access to supervariables via $$variable does not function as documented.
Submitted: 2003-10-30 23:38 UTC Modified: 2003-10-31 07:50 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: dw-bugs dot php dot net at botanicus dot net Assigned:
Status: Wont fix Package: Scripting Engine problem
PHP Version: 4.3.3 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: dw-bugs dot php dot net at botanicus dot net
New email:
PHP Version: OS:

 

 [2003-10-30 23:38 UTC] dw-bugs dot php dot net at botanicus dot net
Description:
------------
From the implementation I suppose this is pretty obvious, but the following does not work:

   $data_source = '_POST';
   $data =& $$data_source;

'$data' does not point at $_POST as expected. I'd consider this a problem - your implementation is showing through. Either re-label $_POST, etc. as not actually being superglobals, or fix the underlying implementation (which does not at present match up with your documentation).

"""This is a 'superglobal', or automatic global, variable. This simply means that it is available in all scopes throughout a script."""

This statement is not true, since the variable is only 'automatic global' when referred to by name directly (and thus gets caught by your special case code). It does not actually exist in every scope.

I beg you not to mark this as a documentation problem and change the docs to mention this. Fix it! It's a horrible inconsistancy. This, along with a million other sour points, is the reason why I absolutely detest my day job at the minute. Come on guys! Do it for me!

Reproduce code:
---------------
$data_source = '_POST';
$data =& $$data_source;

echo gettype($data);

Expected result:
----------------
array

Actual result:
--------------
NULL

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-10-31 04:44 UTC] andi@php.net
Hi,

This is by-design and it's the price you have to pay for these special superglobals. A price which is worth paying...
If this is not documented in the online docs then feel free to drop a line to phpdoc@lists.php.net with the wording you think should be added
 [2003-10-31 05:01 UTC] dw-bugs dot php dot net at botanicus dot net
Will this be fixed in Zend2?
 [2003-10-31 07:50 UTC] sniper@php.net
No. 
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Mon Jul 04 04:05:46 2022 UTC