Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:108903 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 67133 invoked from network); 9 Mar 2020 07:17:31 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 9 Mar 2020 07:17:31 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 9F7421804E6 for ; Sun, 8 Mar 2020 22:38:06 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS35329 80.237.132.0/24 X-Spam-Virus: No X-Envelope-From: Received: from wp160.webpack.hosteurope.de (wp160.webpack.hosteurope.de [80.237.132.167]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sun, 8 Mar 2020 22:38:05 -0700 (PDT) Received: from [2a02:8109:9d40:1d44:19ae:717a:50a6:57a6]; authenticated by wp160.webpack.hosteurope.de running ExIM with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) id 1jBB75-0007dg-3q; Mon, 09 Mar 2020 06:38:03 +0100 To: Matthew Brown Cc: internals@lists.php.net References: <1845472b-08ab-bb31-dc77-23c620b8d217@mabe.berlin> <4D79715B-D9F8-42F8-B0DB-4EA7B6DBFB6A@gmail.com> Message-ID: <58110de6-9d68-869c-9381-d50c1ea46616@mabe.berlin> Date: Mon, 9 Mar 2020 06:38:02 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: <4D79715B-D9F8-42F8-B0DB-4EA7B6DBFB6A@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-bounce-key: webpack.hosteurope.de;marc@mabe.berlin;1583732286;327e14db; X-HE-SMSGID: 1jBB75-0007dg-3q Subject: Re: [PHP-DEV] Bug Wrong resolution of "Late Static Binding" after self::method() From: marc@mabe.berlin (Marc) Hi, On 08.03.20 17:54, Matthew Brown wrote: > This is expected behaviour given my understanding of how late static binding works: > > If there is a chain of “self::” calls that ultimately ends in “static::someMethod”, then PHP behaves as if every preceding call was a call to “static::”, not “self::”. In your second call you’re explicitly overriding that resolution by changing using (self::class)::someMethod, which PHP always treats as A::someMethod, thus producing the expected output. Thanks for explaining. I couldn't find any information for this behavior in the documentation - Is that documented anywhere? Does it make sense? -> I have read "self::" all time as a shortcut for "MyClass::" until I noticed this is not the case and I expect most PHP devs would explain it this way. Is there a reason why self:: doesn't reset the internal "static" reference? Sorry for all these questions. Sometimes the world could be so simple until it turns out it isn't for no reason. Thanks, Marc