Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:89500 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 45052 invoked from network); 30 Nov 2015 15:07:48 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Nov 2015 15:07:48 -0000 Authentication-Results: pb1.pair.com header.from=laruence@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=laruence@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.43 as permitted sender) X-PHP-List-Original-Sender: laruence@gmail.com X-Host-Fingerprint: 209.85.220.43 mail-pa0-f43.google.com Received: from [209.85.220.43] ([209.85.220.43:33556] helo=mail-pa0-f43.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 23/2F-04444-3466C565 for ; Mon, 30 Nov 2015 10:07:48 -0500 Received: by pabfh17 with SMTP id fh17so193054509pab.0 for ; Mon, 30 Nov 2015 07:07:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=7p1cQ3VtncNeH7NwFhgOSjCGOfv6U0gm1wCtshXuft4=; b=V+/tRUXO4o9Sc6aNDaZOhcLmsAu0fwSHsIdftHll0Hrf27uqJENvGDERVdNToV3Gv9 m4EgdoSSjD/tADIXhWduv2yI4jCgW41kSlWyh5bSXYrFobxYx4FqdKx3W/ga+g2V8VXN 18HXK/Wr3lrQFEsMZXUhQLXTA8uFN5XdVk9nIEGnM0YlENJtvXANs84tqQzqGMTGDRcq 5GeDMqhOTVTcSoP8Jtps1+J1ukPepV7k48WiKMp92jsN83YMVhzwASPTYu/B4liw2nWV QzYYCZ2zyVElKBGKYTX819j9wjXSPyLbfUBJpAZqRgfKqcMAT1BWMtv44lsC9+QYn/Vz b0HQ== X-Received: by 10.98.79.202 with SMTP id f71mr71660999pfj.21.1448896065131; Mon, 30 Nov 2015 07:07:45 -0800 (PST) Received: from [10.10.0.10] ([104.156.238.117]) by smtp.gmail.com with ESMTPSA id x79sm51877832pfi.47.2015.11.30.07.07.43 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 30 Nov 2015 07:07:44 -0800 (PST) Content-Type: text/plain; charset=gb2312 Mime-Version: 1.0 (1.0) X-Mailer: iPhone Mail (13A452) In-Reply-To: <565C61DB.3010704@gmail.com> Date: Mon, 30 Nov 2015 23:07:40 +0800 Cc: internals@lists.php.net Content-Transfer-Encoding: quoted-printable Message-ID: References: <565C3FD7.6000602@heigl.org> <565C61DB.3010704@gmail.com> To: Rowan Collins Subject: Re: [PHP-DEV] Re: static:: and PHP 7 (from bug #70997) From: laruence@gmail.com (Xinchen Hui) Hey=A3=BA > On Nov 30, 2015, at 22:48, Rowan Collins wrote: >=20 > Andreas Heigl wrote on 30/11/2015 12:23: >>> Am 30.11.15 um 13:18 schrieb Peter Cowburn: >>> class A { >>>> const TEST =3D false; >>>> public function test() { >>>> var_dump(static::TEST); >>>> } >>>> } >>>>=20 >>>> class B extends A { >>>> const TEST =3D true; >>>>=20 >>>> public function test() { >>>> A::test(); >>>> } >>>> } >>>>=20 >>>> $b =3D new B; >>>> $b->test(); >> You are calling explicitly A::test(). >>=20 >> When you call parent::test() everything works as you'd expect it. >>=20 >> Have a look at https://3v4l.org/RCrRd >>=20 >> Apart from that you are calling an instance-method as a static method by >> using A::test(). >=20 > This appears to be the crucial thing: if you declare the test() method as s= tatic in both classes, it returns false in all versions: https://3v4l.org/hJ= oor >=20 > It's almost like A::test() is now interpreted as a static call, rather tha= n a "scope resolution" of the instance method, but $this is still available,= so it's not quite as simple as that: https://3v4l.org/qbT3j >=20 dmitry has committed a fix, please have a look Thanks > Regards, > --=20 > Rowan Collins > [IMSoP] >=20 >=20 >=20 >=20 > --=20 > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php