Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:98546 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 75636 invoked from network); 15 Mar 2017 21:14:35 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Mar 2017 21:14:35 -0000 Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=nikita.ppv@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.47 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 74.125.82.47 mail-wm0-f47.google.com Received: from [74.125.82.47] ([74.125.82.47:35063] helo=mail-wm0-f47.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BF/82-38004-ABEA9C85 for ; Wed, 15 Mar 2017 16:14:34 -0500 Received: by mail-wm0-f47.google.com with SMTP id u132so20835635wmg.0 for ; Wed, 15 Mar 2017 14:14:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=YixJ+vLglZWix9PR5NJqpY/cj7VGTURVupU1QG0A480=; b=dw0SQ5e5r8hhX9wcB6ZjTvGbtsyba3ZKuoX9HGQKfB2KqnRKbuQRF/bPiEDgh5YNo2 GZ1MUSAl7pCV3xQZ165PxfGJjW+KMwqbAd8I59gnc6WRtI1HcHvk/cIYPO/2Vp8xdAqV baCHqnYyF4h9b/RcVQ7xBn4Af78j/VVCLQ3j4DgMRsw77eO5pwMdTUAnvhYAoNWsCkVu e0OPrnh69MYo6LkfQ+f1QSTibONlU2MTcVyrSeNosE1N5RS+WNz1d904DVVMPDMKZO2b 9xBRdfi5+l/J858tRs+IzWUcApq+n0841WNTzwHycSjoieqQPGbQNA5qj2l5Mf7aKfjm 9A7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=YixJ+vLglZWix9PR5NJqpY/cj7VGTURVupU1QG0A480=; b=WjPkgRZhUf5oyBBV8iz8QJbEVK8xLiBMsDzLS1qLUwP6W916hUHA2GymWmJ6OesO4X FLghyrEFQUnafiGyTic14ietETitexZGrvGkMvGd6FXb3GFQzlkA6sG+FWkFAees+BGt xjdQXqbDIl0xARwSFOmIa2oBMuYo45pWOAteIAHlNPY8FU09B8rdiE5L/lSdVxok5QwU bPdEOYq/HQjZT9nGbDl8Lbhr47M65m8tezXB/ckUVClu4IFRZnAAfNIclSQMUaRv+fO0 Qq53W13DTDOCrF1oQWlWIVAUsY7R3I4GnFpBkVO3Knk03idCinU55gNumw2XqTRCD3qf k7ZA== X-Gm-Message-State: AFeK/H35EiUlKAIDmDTeQuTNKEsEnRAq/0VW68Ahp7sAytzdaKDdCzu2FrPFSgy9NBYAZhfPAghY3LqV/k1gOw== X-Received: by 10.28.23.66 with SMTP id 63mr6349283wmx.46.1489612471752; Wed, 15 Mar 2017 14:14:31 -0700 (PDT) MIME-Version: 1.0 Received: by 10.223.170.216 with HTTP; Wed, 15 Mar 2017 14:14:31 -0700 (PDT) In-Reply-To: References: Date: Wed, 15 Mar 2017 22:14:31 +0100 Message-ID: To: Sara Golemon Cc: PHP internals Content-Type: multipart/alternative; boundary=001a11468aa83b6292054acb6e93 Subject: Re: [PHP-DEV] Unexpected results from constant folding From: nikita.ppv@gmail.com (Nikita Popov) --001a11468aa83b6292054acb6e93 Content-Type: text/plain; charset=UTF-8 On Wed, Mar 15, 2017 at 3:53 PM, Sara Golemon wrote: > On Wed, Mar 15, 2017 at 5:36 AM, Nikita Popov > wrote: > > Yes, this should behave as C. See also https://bugs.php.net/bug.php? > id=69676 > > for an existing bug report on the topic. > > > Given that bug is assigned to you, I'll just leave it in your hands then? > > > I think in 7.1 it might be even fairly simple so fix this: IIRC we now > store > > the defining CE on inherited constants, so we should know the scope to > > resolve against. > > > Even in 7.0 you could rewrite unresolved self:: references to the > current classname.Not as clean when it comes to producing error > messages, but certainly a quick and easy fix for the case where the > userspace code isn't broken. > > I had initially been thinking multi-pass, but there are some pretty > easy edge cases to fall into there... Fixed in 7.1 by https://github.com/php/php-src/commit/2bba4a0d7f6d5e5712d60bc1cf2119622d837e55 . I personally don't consider a PHP 7.0 backport worthwhile, as this is a long standing issue (from early PHP 5 days) and the fix will probably be hacky on 7.0. Note that CT resolving self:: doesn't quite cut it, because you also have to deal with parent::, which the compiler currently does not track. An alternative would be to force a full constant update on any parent CE, to ensure they will be evaluated in the correct order. Of course, this has other side effects, because it changes the point in time at which a certain constant is updated. Regards, Nikita --001a11468aa83b6292054acb6e93--