Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:89154 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 76477 invoked from network); 10 Nov 2015 19:31:35 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Nov 2015 19:31:35 -0000 Authentication-Results: pb1.pair.com header.from=bishop.bettini@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=bishop.bettini@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.51 as permitted sender) X-PHP-List-Original-Sender: bishop.bettini@gmail.com X-Host-Fingerprint: 74.125.82.51 mail-wm0-f51.google.com Received: from [74.125.82.51] ([74.125.82.51:36989] helo=mail-wm0-f51.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 92/D6-21426-71642465 for ; Tue, 10 Nov 2015 14:31:35 -0500 Received: by wmww144 with SMTP id w144so15082200wmw.0 for ; Tue, 10 Nov 2015 11:31:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:sender:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=tCg5YMnUJCFl7orkTYZpdLF+Q1QasjPTFb8rrtrv2s4=; b=BNJ285Y8efxgovyZM7nGqfQmxFuh4hAbYNRcXC25ppuPo29HnAfmiWBFXMUcpyco49 STwx8uGHFuUB3KsKlv8O8WAh6PFfgxtUowtCPEcqDslTHI2VQx7ZBHibduTSb2iwXLVI Z2r4Ro9SQhqQReeGpoIoEDUvVw9PGC7m/H6/4Lwqgdwnei8fDVriMkjehApodAQGRWCC d9PdXOjz8IYEREKpK911dqSCENJG4iiNwCWsq2dPCAbgfyUpqcZS74WhxftmayQ17s3y PHaSUimVFkLF5TalmHHQgHrV9+6DAKeKLRtjFGrPscXjRz65yz780PP5N+qoxl9SBVdz Hr8A== MIME-Version: 1.0 X-Received: by 10.28.145.134 with SMTP id t128mr32573429wmd.64.1447183892743; Tue, 10 Nov 2015 11:31:32 -0800 (PST) Reply-To: bishop@php.net Sender: bishop.bettini@gmail.com Received: by 10.194.42.228 with HTTP; Tue, 10 Nov 2015 11:31:32 -0800 (PST) In-Reply-To: References: Date: Tue, 10 Nov 2015 14:31:32 -0500 X-Google-Sender-Auth: gBqDu0-w0WJ1MQ81Tbr84-TzHNk Message-ID: To: Philip Hofstetter Cc: PHP internals Content-Type: multipart/alternative; boundary=001a1146ec36da0e60052434c1a9 Subject: Re: [PHP-DEV] PHP7 / foreach / references / ugly code / discrepancy to PHP 5.6 From: bishop@php.net (Bishop Bettini) --001a1146ec36da0e60052434c1a9 Content-Type: text/plain; charset=UTF-8 On Tue, Nov 10, 2015 at 11:48 AM, Philip Hofstetter < phofstetter@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 and Same for PHP 7.0 .) 2. The optimizer isn't handling the foreach scenario. (See Block pass optimizer code .) I don't see any change notes for either, so I'm guessing this is a bug. bishop --001a1146ec36da0e60052434c1a9--