php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #72500 Imprecision about compatibility of "Variable variables and global"
Submitted: 2016-06-27 08:24 UTC Modified: 2016-06-27 09:43 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: gwenael dot chailleu at gmail dot com Assigned: aharvey
Status: Assigned Package: Documentation problem
PHP Version: 7.0.8 OS:
Private report: No CVE-ID:
Have you experienced this issue?
Rate the importance of this bug to you:

 [2016-06-27 08:24 UTC] gwenael dot chailleu at gmail dot com
Description:
------------
Hello,

I can read in http://php.net/manual/fr/migration70.incompatible.php that "Variable variables can no longer be used with the global keyword. ". In my interpretation of this warning "global $$var;" is no longer a valid syntax and must be replaced by "global ${$var};" . But, obviously, "global $$var;" it still accepted (only tested in php 7.0.4). Is this particular syntax planned to be removed ? The code example given (global $$foo->bar;) should rather illustrate the new left-to right evaluation order of the expressions including variable variables syntax.

Thanks for your answer !


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-06-27 09:43 UTC] cmb@php.net
-Assigned To: +Assigned To: aharvey
 [2016-06-27 09:43 UTC] cmb@php.net
I agree that this section[1] is not clear enough, and that the
example is indeed more related to the new uniform variable
syntax[2]. At least variable variables appear to work fine with
global, see <https://3v4l.org/fvtGd>. I'm assigning to Adam who
made the relevant commit (r337333). Can you please clarify, Adam?

[1] <http://php.net/manual/en/migration70.incompatible.php#migration70.incompatible.variable-handling.global>
[2] <https://wiki.php.net/rfc/uniform_variable_syntax>
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Tue Aug 29 15:01:52 2017 UTC