Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:94283 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 81754 invoked from network); 27 Jun 2016 15:41:45 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Jun 2016 15:41:45 -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 209.85.218.66 as permitted sender) X-PHP-List-Original-Sender: bishop.bettini@gmail.com X-Host-Fingerprint: 209.85.218.66 mail-oi0-f66.google.com Received: from [209.85.218.66] ([209.85.218.66:36614] helo=mail-oi0-f66.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AC/D6-40393-63941775 for ; Mon, 27 Jun 2016 11:41:43 -0400 Received: by mail-oi0-f66.google.com with SMTP id x6so31237096oif.3 for ; Mon, 27 Jun 2016 08:41:42 -0700 (PDT) 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:from:date :message-id:subject:to:cc; bh=uWr4sJJ9nqtFIbeO2+xQzLpuX9E3UCX7AE3/L07GPsw=; b=f8rwCAmxMCs4JxdoctDZvd0g+n9SASeu/6uJEuG8yB26VUkqrfXtcUdYoqWli7Fl6+ L0ky2qrpa6geVbayW0+4PKM342WBF2zJfUikUGqlzgPxSlynIiKcPH4AOp5iqiak7fa3 eue+QseeF3EDfgOoNJPe5ssau9nSdHXqToPd/9g3Ys2zd8SZAWRRkvPenGSSC5EjRhVs w/GEzRo0rcrRzt+GcO4x0YVYAXi9BNKZAOewn88DVJWPUSACXOeS3Tq6bKZD74DmVgyk Ycnf7osDyXp9Am3VBo3TOWeagAGxbGq6RyUKPlB8AbrkiK/4dQcWXQ/5c4zoqGnkAyXC Pv4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:reply-to:sender:in-reply-to :references:from:date:message-id:subject:to:cc; bh=uWr4sJJ9nqtFIbeO2+xQzLpuX9E3UCX7AE3/L07GPsw=; b=BZXuRb3UT74YQyYJjY6IlyH06j08fTNKYfuTbXZEaFtnyzyCGTQ4LS++yZAdzg2bcD fcG/rOqvxrsT8j6w3gv4ppdDrQlt6RDP/C9LphG85mMOAOrkHDROey6V5XffPLlsoyKQ Fs1TugsHaL8VQXTKHRsTxlUpvtcnpTfKzaXsVehzp7uwtkhhTHFA7hDk6a9Dzm6UZldV +BcDPOnmH7ZAluXh+Tb541OPGcxYbzjmcXUNfcOm8SUD8Miy/zgKq62cYY3aIabNg99Y 700BKf6qm3Zil6ryYdyUpvQIKRRvWUTi98cjOIharat7FTDLjLdpLRVhfQ/XIC/rfBpW uHlg== X-Gm-Message-State: ALyK8tLijQezoawWvnBPYkvXknVtnKta9i7o5Og0wuI0rQ4NiBbIprvQHGHh8V+cn/p/Y41+11N3FhfZB1ztFQ== X-Received: by 10.202.229.9 with SMTP id c9mr1000115oih.42.1467042099992; Mon, 27 Jun 2016 08:41:39 -0700 (PDT) MIME-Version: 1.0 Reply-To: bishop@php.net Sender: bishop.bettini@gmail.com Received: by 10.157.42.164 with HTTP; Mon, 27 Jun 2016 08:41:10 -0700 (PDT) In-Reply-To: <500b1edb-ab52-da1e-5874-0fafa5dd8a7f@heigl.org> References: <5d2a68ac-ccd8-59a9-31a8-91e40ecae12f@heigl.org> <500b1edb-ab52-da1e-5874-0fafa5dd8a7f@heigl.org> Date: Mon, 27 Jun 2016 11:41:10 -0400 X-Google-Sender-Auth: QK_yEvjKjHDQ7U0RlrVbHSkiW7I Message-ID: To: Andreas Heigl Cc: =?UTF-8?Q?Karl_Pfl=C3=A4sterer?= , PHP internals Content-Type: multipart/alternative; boundary=001a11406d2a3da8d70536445b95 Subject: Re: [PHP-DEV] Possible Bug with Interface, Constants and Inheritance From: bishop@php.net (Bishop Bettini) --001a11406d2a3da8d70536445b95 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Mon, Jun 27, 2016 at 11:31 AM, Andreas Heigl wrote: > Am 27.06.16 um 15:28 schrieb Karl Pfl=C3=A4sterer: > > Andreas Heigl writes: > > > >> Am 27.06.16 um 15:01 schrieb Karl Pfl=C3=A4sterer: > >>> interface I1 { const C1 =3D '';} > >>> class C3 implements I1 { const C1 =3D 'c2';} > >>> $c3 =3D new C3; > >>> var_dump($c3::C1); > >> > >> According to https://3v4l.org/jIcs6 it looks like that's intended > >> behaviour ;) > > > > But why does it work in the CLI if I write the code (instead of using a > > script)? That's my question. > > It doesn't. At least not on my machine. This is the output I get: > > $ php -v > PHP 7.1.0alpha2 (cli) (built: Jun 24 2016 13:50:28) ( NTS ) > Copyright (c) 1997-2016 The PHP Group > Zend Engine v3.1.0-dev, Copyright (c) 1998-2016 Zend Technologies > Technically, this is a different version than reported. Nonetheless, on the same version my REPL complains as well, I suspect because the original report misspelled the INI setting ("-ddispplay_errors=3DOn", notice the double "p"): $ php -v PHP 7.0.7 (cli) (built: May 28 2016 08:26:36) ( NTS ) Copyright (c) 1997-2016 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies with Xdebug v2.4.0, Copyright (c) 2002-2016, by Derick Rethans $ php -a Interactive shell php > interface I1 { const C1 =3D ''; } php > class C3 implements I1 { const C1 =3D 'c2'; } PHP Fatal error: Cannot inherit previously-inherited or override constant C1 from interface I1 in php shell code on line 1 PHP Stack trace: PHP 1. {main}() php shell code:0 > So it crashes with a fatal error when Implementing the interface. It'S > interesting though that the script allows me to instantiate the class > nonetheless. That's right. > Under normal interpretive operation, the Fatal terminates the script. But in the case of the REPL command line, those are swallowed up and you can keep going. Same as like: php > foo(); PHP Warning: Uncaught Error: Call to undefined function foo() in php shell code:1 Stack trace: #0 {main} thrown in php shell code on line 1 PHP Stack trace: PHP 1. {main}() php shell code:0 php > echo 'hi'; hi I'm not seeing any bugs here. bishop --001a11406d2a3da8d70536445b95--