On Tue, Nov 10, 2015 at 11:48 AM, Philip Hofstetter < phofstet...@sensational.ch> wrote:
> Hi, > ...snip... > I guess this is related to > > http://php.net/manual/en/migration70.incompatible.php#migration70.incompatible.foreach.by-value > or > > http://php.net/manual/en/migration70.incompatible.php#migration70.incompatible.foreach.by-ref > , > but I'm not entirely sure whether this is actually intended behaviour - > it's certainly unexpected to me that applying ?: now always makes a copy > whereas before it didn't. > The issue may not be with foreach, but instead with the ?: ternary or the optimizer. Maybe either: 1. It's a side-effect of merging the ZEND_QM_ASSIGN and ZEND_QM_ASSIGN_VAR op codes. (See PHP 5.6 ?: op code definitions <https://github.com/php/php-src/blob/PHP-5.6/Zend/zend_vm_def.h#L4977-L5021> and Same for PHP 7.0 <https://github.com/php/php-src/blob/master/Zend/zend_vm_def.h#L6945-L6977> .) 2. The optimizer isn't handling the foreach scenario. (See Block pass optimizer code <https://github.com/php/php-src/blob/master/ext/opcache/Optimizer/block_pass.c#L574-L593> .) I don't see any change notes for either, so I'm guessing this is a bug. bishop