Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:98532 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 17225 invoked from network); 15 Mar 2017 03:15:37 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Mar 2017 03:15:37 -0000 Authentication-Results: pb1.pair.com header.from=theanomaly.is@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=theanomaly.is@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.42 as permitted sender) X-PHP-List-Original-Sender: theanomaly.is@gmail.com X-Host-Fingerprint: 74.125.82.42 mail-wm0-f42.google.com Received: from [74.125.82.42] ([74.125.82.42:38313] helo=mail-wm0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E1/3C-38004-7D1B8C85 for ; Tue, 14 Mar 2017 22:15:35 -0500 Received: by mail-wm0-f42.google.com with SMTP id t189so12907128wmt.1 for ; Tue, 14 Mar 2017 20:15:35 -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=YtRKuPuRXUv9EfAh1YPFLgeEE8rLXwJUwyvynLLuE/M=; b=srRU9TdOsY5IG+sdfuRSGAVac+pjM5ji9UAXzCkqrswJb0OEVT85Zf9lYJ2JrHa43j kJtQpqrdp9LCupDY6y68XTf1CTWz7eU/Sgw0Qyib70jeUxR1ItZGPXgYpRgspf9SePxv +ykoDDYiXRycRoDi207bQ/L2MdCkYSOYij1/bF2327yDgdDdnXEIRVX6afHpokUHRalR 0d/3iOeDgEhAs5I4mbDJbx2uCKNcbLAOKYj6hEUA+wdIEbKV4bzempjHsh+g/wzKFmyQ zlmVScjoNonBQG8WaMvku5+9yAaow/2hPh7i1HEaYQYp5NSEbcB9Ry6aUJuBHRfX+ShZ pDwg== 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=YtRKuPuRXUv9EfAh1YPFLgeEE8rLXwJUwyvynLLuE/M=; b=LiXdrbnw+1UFFmjsNouNgpWt2XVmEHhYJPWXsREbJiazcOPCWeh+wlLJ9Xn3PKLaj/ lDnjYbGBeXtILzcTyQo++YVH3dcYkAYdtlU8EcGNE6CcLCYk32DMnm1ngqzeDT2Uj7Bi lswZ0xKrOa0bgirmgUZOw8prVNOEr/xWzIeSfoPObb4nA3tNDXrWyvJZNo+SozpdCMED RoLy7jI6+Yp0IxEeELtxo9QY0UMMrET4ENYOnp5agWV3RhIp8vioMHIcYcB/KiP3PIY4 ks6kyX4L5kUMfHArtq41hu440vDDHd5CAWXfg7/Ppxr63oxpWAz0zZATaIr6ICI8BFjD rJJQ== X-Gm-Message-State: AFeK/H1u8kY44NVRDeMFSGnPHm7z6/sJFsOLhTw5+P8cErp9thLeLkkpwX0bhR0r2o4R0Gw3OK+bMoIfbbH5kg== X-Received: by 10.28.216.208 with SMTP id p199mr2243435wmg.44.1489547732559; Tue, 14 Mar 2017 20:15:32 -0700 (PDT) MIME-Version: 1.0 Received: by 10.80.143.35 with HTTP; Tue, 14 Mar 2017 20:15:32 -0700 (PDT) In-Reply-To: References: Date: Tue, 14 Mar 2017 23:15:32 -0400 Message-ID: To: Sara Golemon Cc: PHP internals Content-Type: multipart/alternative; boundary=001a114733c079b224054abc5b93 Subject: Re: [PHP-DEV] Unexpected results from constant folding From: theanomaly.is@gmail.com (Sherif Ramadan) --001a114733c079b224054abc5b93 Content-Type: text/plain; charset=UTF-8 I would definitely vote C as well. PHP 7's behavior makes even less sense than PHP 5 in this case. On Tue, Mar 14, 2017 at 10:43 PM, Sara Golemon wrote: > This comes in thanks to my old friend Fred Emmott on the HHVM project: > https://3v4l.org/vUHq3 > > class Foo { > const A = 1 << 0; > const B = self::A | self::C; > const C = 1 << 1; > > } > > class Bar extends Foo { > const A = 1 << 2; > const C = 1 << 3; > } > > var_dump(decbin(Bar::B)); > // HHVM result: 11 > // PHP5 result: 1100 > // PHP7 result: 1001 > > HHVM's result is clearly correct as `self::` refers to the defining > class and so should bind to Foo's values for A and C. > PHP5's result is at least rationally viable, although it effectively > redefines `self::` to the semantics of `static::` just for this case. > PHP7's result is... well, I can imagine how it occurs, but it can't be > called correct by any measure. > > Opinions on the right thing to do here? > a) Leave it alone because it's been that way since 7.0 > b) Revert to php5 behavior > c) Match HHVM's behavior > > I vote C because that's the semantic meaning of self:: and we should > respect PHP's own language rules. > Barring that, I'd be okay with B as it's at least explainable without > too much mental gymnastics. > I straight up veto A. That's just cray-cray. > > -Sara > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --001a114733c079b224054abc5b93--