Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:89499 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 42543 invoked from network); 30 Nov 2015 14:49:24 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Nov 2015 14:49:24 -0000 Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.41 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 74.125.82.41 mail-wm0-f41.google.com Received: from [74.125.82.41] ([74.125.82.41:37456] helo=mail-wm0-f41.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 23/CE-04444-3F16C565 for ; Mon, 30 Nov 2015 09:49:23 -0500 Received: by wmww144 with SMTP id w144so140764514wmw.0 for ; Mon, 30 Nov 2015 06:49:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-type:content-transfer-encoding; bh=g8IYhmgH1W9VWhdvEtqwSpJh52ktMSDJ7GJ9icjTCG4=; b=QgW8p4VHzGGNO7lNQxAAJcjiBrjpKNnO/DEx/VXVREK7Wpz836ngZ5Fbxsia75jCVz g1J+nRAS+voOjE29Gvug0eYjbFgeXUdSelY4YtUEDx98q8vCvh5XgrHO8iEVHW3qlF1o S5Jj0r1uizHWtRCU3OsOsq8VmfOrGT2ZX9oe11Fzoopka7UsxJvHw+01qZlrZXkejPOo 2WJTRml0pKRJTnb3LkxT+mX8bM6a7HfvQp6jqSRbOaZQ8UBwxz3qcfyNM29yKEro8Cdm 1CYIAV/QgjSMLLKI3b0ZBwJ/79impS8bX2J28DIoKzkjKRSzI2YR3e99+0lmqBG8J+FD 3YVA== X-Received: by 10.28.226.86 with SMTP id z83mr30283072wmg.77.1448894959910; Mon, 30 Nov 2015 06:49:19 -0800 (PST) Received: from [192.168.0.132] ([93.188.182.58]) by smtp.googlemail.com with ESMTPSA id h7sm21618833wmf.0.2015.11.30.06.49.18 for (version=TLSv1/SSLv3 cipher=OTHER); Mon, 30 Nov 2015 06:49:19 -0800 (PST) To: internals@lists.php.net References: <565C3FD7.6000602@heigl.org> Message-ID: <565C61DB.3010704@gmail.com> Date: Mon, 30 Nov 2015 14:48:59 +0000 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <565C3FD7.6000602@heigl.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Re: static:: and PHP 7 (from bug #70997) From: rowan.collins@gmail.com (Rowan Collins) Andreas Heigl wrote on 30/11/2015 12:23: > Am 30.11.15 um 13:18 schrieb Peter Cowburn: >> class A { >>> const TEST = false; >>> public function test() { >>> var_dump(static::TEST); >>> } >>> } >>> >>> class B extends A { >>> const TEST = true; >>> >>> public function test() { >>> A::test(); >>> } >>> } >>> >>> $b = new B; >>> $b->test(); >>> > You are calling explicitly A::test(). > > When you call parent::test() everything works as you'd expect it. > > Have a look at https://3v4l.org/RCrRd > > Apart from that you are calling an instance-method as a static method by > using A::test(). This appears to be the crucial thing: if you declare the test() method as static in both classes, it returns false in all versions: https://3v4l.org/hJoor It's almost like A::test() is now interpreted as a static call, rather than 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 Regards, -- Rowan Collins [IMSoP]