Doc #70095 [Asn->Opn]: Operator precedence changed in PHP 7

From: Date: Tue, 24 Oct 2017 06:28:32 +0000
Subject: Doc #70095 [Asn->Opn]: Operator precedence changed in PHP 7
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-15140@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=70095&edit=1

 ID:                 70095
 Updated by:         kalle@php.net
 Reported by:        me at evertpot dot com
 Summary:            Operator precedence changed in PHP 7
-Status:             Assigned
+Status:             Open
 Type:               Documentation Problem
 Package:            Scripting Engine problem
 Operating System:   Any
 PHP Version:        7.0.0beta1
-Assigned To:        pasindu
+Assigned To:        
 Block user comment: N
 Private report:     N



Previous Comments:
------------------------------------------------------------------------
[2015-07-18 16:37:29] pasindu@php.net

This is probably not documented, TODO for documentation

------------------------------------------------------------------------
[2015-07-18 16:19:14] requinix@php.net

Yes, it's intentional. https://wiki.php.net/rfc/uniform_variable_syntax

------------------------------------------------------------------------
[2015-07-18 16:14:49] me at evertpot dot com

Description:
------------
The code from the description now has a different output. I'm not sure if it's
intentional, so I decided to post it as a bug. It's definitely a BC change.

Also see:

http://3v4l.org/pE0UN



Test script:
---------------
<?php

$foo = [
   'a' => 'b'    
];

$bar = [
   'b' => 'c'  
];

$bar = (object)$bar;

// Note that the following line is interpreted as
// $bar->b in PHP < 7, and $bar->Array in PHP > 7.
echo $bar->$foo['a'];

Expected result:
----------------
c


Actual result:
--------------
Notice: Array to string conversion in /in/pE0UN on line 14 Notice: Undefined property:
stdClass::$Array in /in/pE0UN on line 14


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=70095&edit=1


Thread (3 messages)

« previous php.doc.bugs (#15140) next »