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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Wed Feb 05 20:01:30 2025 UTC