Re: Re: static:: and PHP 7 (from bug #70997)
| From: | Andreas Heigl | Date: | Mon, 30 Nov 2015 12:23:51 +0000 |
| Subject: | Re: Re: static:: and PHP 7 (from bug #70997) | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-89492@lists.php.net to get a copy of this message | ||
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().
Cheers
Andreas
--
,,,
(o o)
+---------------------------------------------------------ooO-(_)-Ooo-+
| Andreas Heigl |
| mailto:andreas@heigl.org N
50°22'59.5" E 08°23'58" |
| http://andreas.heigl.org http://hei.gl/wiFKy7 |
+---------------------------------------------------------------------+
| http://hei.gl/root-ca
|
+---------------------------------------------------------------------+
Attachment: [application/pkcs7-signature] S/MIME Cryptographic Signature smime.p7s
Attachment: [application/pkcs7-signature] S/MIME Cryptographic Signature smime.p7s