php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #66223 Undefined variable: _GET
Submitted: 2013-12-03 06:30 UTC Modified: 2013-12-03 17:53 UTC
From: yky at yky dot pw Assigned:
Status: Duplicate Package: Testing related
PHP Version: 5.4.22 OS: windows7
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: yky at yky dot pw
New email:
PHP Version: OS:

 

 [2013-12-03 06:30 UTC] yky at yky dot pw
Description:
------------
In Class can't indirect use $_GET、$_POST etc;

Test script:
---------------
$_GET['yk'] = 'aabb';
$get = '_GET';
$tmp = $$get;
echo $tmp['yk'];     //right

class yk{
	
	public function get(){
		$get = '_GET';
		$tmp = $$get;
		echo $tmp['yk'];
	}
	
	public function get2(){
		$get = 'Atmp';
		$Atmp = 'bbaa';
		$tmp = $$get;
		echo $tmp;
	}
}

$yk = new yk();
$yk->get();   //error  Undefined variable: _GET


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-12-03 17:53 UTC] nikic@php.net
-Status: Open +Status: Duplicate
 [2013-12-03 17:53 UTC] nikic@php.net
Duplicate of https://bugs.php.net/bug.php?id=55493. This behavior is classified Won't Fix and documented with the last note on http://www.php.net/manual/en/language.variables.superglobals.php.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 27 10:01:29 2024 UTC