Edit report at https://bugs.php.net/bug.php?id=70586&edit=1
ID: 70586
Updated by: [email protected]
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] [email protected]
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.