Bug #70586 [Ver->Nab]: When i try ${'_'.'POST'} i get: Notice: Undefined variable: _POST in

From: Date: Sat, 19 Dec 2015 10:26:33 +0000
Subject: Bug #70586 [Ver->Nab]: When i try ${'_'.'POST'} i get: Notice: Undefined variable: _POST in
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-198035@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=70586&edit=1 ID: 70586 Updated by: nikic@php.net Reported by: DAVIDhaker at yandex dot ru Summary: When i try ${'_'.'POST'} i get: Notice: Undefined variable: _POST in -Status: Verified +Status: Not a bug Type: Bug Package: Variables related Operating System: Windows 10 Pro x64 PHP Version: 5.6.14RC1 Block user comment: N Private report: N New Comment: Accessing super globals through variable variables is undefined behavior. It may or may not work depending on whether the variable name is evaluated at compile-time or not. Previous Comments: ------------------------------------------------------------------------ [2015-12-19 04:14:37] ajf@php.net Looks like it's fixed in PHP 7: https://3v4l.org/u5Snj Also seems to indeed be specific to __call within a class. I don't get this for just var_dump() at top-level. ------------------------------------------------------------------------ [2015-09-25 20:46:04] DAVIDhaker at yandex dot ru Description: ------------ When i try ${'_'.'POST'} in object __call i get: Notice: Undefined variable: _POST in ... Test script: --------------- <?php class A { public function __call($method, $args){ var_dump($_POST, ${'_POST'}, ${'_'.'POST'}, '_POST' == '_'.'POST', $_POST == ${'_POST'}); } } $class = new A(); $class->test(); Expected result: ---------------- array(0) { } array(0) { } NULL bool(true) bool(true) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=70586&edit=1

« previous php.bugs (#198035) next »