Bug #72123 [Opn->Wfx]: Variable variable assignment from array breaks

From: Date: Thu, 28 Apr 2016 16:53:22 +0000
Subject: Bug #72123 [Opn->Wfx]: Variable variable assignment from array breaks
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-200811@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=72123&edit=1 ID: 72123 Updated by: jhdxr@php.net Reported by: haveacigaro at gmail dot com Summary: Variable variable assignment from array breaks -Status: Open +Status: Wont fix Type: Bug Package: Scripting Engine problem Operating System: osx PHP Version: 7.0.5 Block user comment: N Private report: N New Comment: see http://php.net/manual/en/migration70.incompatible.php Indirect access to variables, properties, and methods will now be evaluated strictly in left-to-right order, as opposed to the previous mix of special cases. The table below shows how the order of evaluation has changed. Code that used the old right-to-left evaluation order must be rewritten to explicitly use that evaluation order with curly braces (see the above middle column). This will make the code both forwards compatible with PHP 7.x and backwards compatible with PHP 5.x. Previous Comments: ------------------------------------------------------------------------ [2016-04-28 15:38:40] haveacigaro at gmail dot com Description: ------------ When creating a variable variable from an array, php identifies the string as an array in php 7, but not in previous versions. Test script: --------------- <?php $content = [ 'layout' => 'heading' ]; $heading = function () { return "Hi"; }; $layout = "heading"; echo $$layout(); // Works echo $$content['layout'](); // Doesnt work ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=72123&edit=1

« previous php.bugs (#200811) next »