Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:92059 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 33659 invoked from network); 1 Apr 2016 01:52:29 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Apr 2016 01:52:29 -0000 Authentication-Results: pb1.pair.com smtp.mail=php@golemon.com; spf=softfail; sender-id=softfail Authentication-Results: pb1.pair.com header.from=php@golemon.com; sender-id=softfail Received-SPF: softfail (pb1.pair.com: domain golemon.com does not designate 209.85.217.195 as permitted sender) X-PHP-List-Original-Sender: php@golemon.com X-Host-Fingerprint: 209.85.217.195 mail-lb0-f195.google.com Received: from [209.85.217.195] ([209.85.217.195:34485] helo=mail-lb0-f195.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 23/98-15473-B54DDF65 for ; Thu, 31 Mar 2016 20:52:28 -0500 Received: by mail-lb0-f195.google.com with SMTP id vk4so8265210lbb.1 for ; Thu, 31 Mar 2016 18:52:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=golemon-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc; bh=IWi6ASKcSHx7OhmCIh8Lj9U3i+IGfjU72s/N+ZITmVY=; b=PkU6Di/QvXBNjTBJr7ygsyiYHylr78/NkPEqAj0A9DLHvoGMQmKf/J6+7XCi5jaTJU 6FfAhJ72jTsUXpCdFt6SKBpXdvGcH8SlO9gEkFYRtXgyZyA+HzjfOUTvYe05cl8Qz4sM rfo2Z+d00RtElxZ/tAw6E0r7mT1TyKnUOvyVOeFbrU9TsepJAI7WZE0sR7VNYsN8CSi/ UgnRcOALdV7CmqTureIM0E6tCZR86VMppbKzzbf0SA6ikPe0oBpfuts7pCfa+Fs4FN0z VcU4I/uQUTV2RhHsWsh59v58gkDWSs0kFSmuSVQ+pIzdRhIzRMfpwDVXpxKdQMjK6INr J6+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:date :message-id:subject:from:to:cc; bh=IWi6ASKcSHx7OhmCIh8Lj9U3i+IGfjU72s/N+ZITmVY=; b=NqBuS3bRP7q+UJDKJcMRbq9kujh8zrq/H4VInrHK322g36z6iHKQSMlI1SGsvs2azu y/eLjF0qL014t2s4FQdK9qN7j+XaDsr/JpZXFgOo/HZUWlhGqS0R00JiDPw04Ih0vTlD O1jA453x9ZmjunKkfHa4kKUKXRDZAa8ROCnstIrY7xymu0fv7sWepS5Nf4mKrV7Ilj1j byib/2Ic0hxkGp+Jei8negfqyriC1eHQdLF9UrcKGUPlzSVjHm55/7gBcBdY93+LksXv uIDFq1wL4iEReeEGsRFraG1wv8eMLY4BXI7UW6suDr47IEMuOXt5E8JSWYbdh1FEHJZ8 sQZg== X-Gm-Message-State: AD7BkJLktgNvpD/rQSVizLsH1GF9f1zUvvaN4X/7hbtQd2ClHM5YxtccoPI99dw0n4Us6Y2e64gfquFNNyieKA== MIME-Version: 1.0 X-Received: by 10.112.143.163 with SMTP id sf3mr733580lbb.117.1459475544586; Thu, 31 Mar 2016 18:52:24 -0700 (PDT) Sender: php@golemon.com Received: by 10.112.18.75 with HTTP; Thu, 31 Mar 2016 18:52:24 -0700 (PDT) X-Originating-IP: [107.198.91.68] In-Reply-To: References: Date: Thu, 31 Mar 2016 18:52:24 -0700 X-Google-Sender-Auth: Mym5aDsBQVecNrZEFXynnHsi9Ac Message-ID: To: Huqiu Liao Cc: PHP internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] Copy On Write and Assign By Reference perform different on PHP5 and PHP7 From: pollita@php.net (Sara Golemon) On Thu, Mar 31, 2016 at 9:47 AM, Huqiu Liao wrote: > I have a question about Assign By Reference and I posted on StackOverflow, > I'd like to know the reason behind it, and I did not get any this kind of > answer, can anyone give me some clues. > Are you asking out of curiosity? Or because you think a new bug has been introduced in PHP7? If the latter, I'd respond by pointing out that the behavior of using multiple operations with side-effects (like pre/post inc/dec) is defined as undefined. That is, while the PHP reference implementation may give you a particular result, you should not rely on that result. If the former, and you're just curious why, it comes down to a very fundamental change in the way PHP7 deals with references. I'd recommend reading Nikita's writeup of the differences between PHP 5 and PHP 7 variables at: https://nikic.github.io/2015/05/05/Internal-value-representation-in-PHP-7-part-1.html -Sara