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
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
30 - 20 = ?
Subscribe to this entry?

 
 [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-2024 The PHP Group
All rights reserved.
Last updated: Wed May 08 16:01:33 2024 UTC