Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:108895 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 57448 invoked from network); 8 Mar 2020 11:27:16 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 8 Mar 2020 11:27:16 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id BD0651804A7 for ; Sun, 8 Mar 2020 01:47:39 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,BODY_8BITS, 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 01:47:38 -0800 (PST) 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 1jAsX3-0000sg-N5; Sun, 08 Mar 2020 10:47:37 +0100 To: internals@lists.php.net Message-ID: <1845472b-08ab-bb31-dc77-23c620b8d217@mabe.berlin> Date: Sun, 8 Mar 2020 10:47:37 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 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;1583660859;67fccf31; X-HE-SMSGID: 1jAsX3-0000sg-N5 Subject: Bug Wrong resolution of "Late Static Binding" after self::method() From: marc@mabe.berlin (Marc) Hi, I have reported a bug in Mai 2019 but did not get any response here https://bugs.php.net/bug.php?id=77985. The problem is that "static::class" as well as "get_called_class()" used within a method resolves to a different class if this method was called with "self::method". Interestingly it works as expected if the method got called with "ClassName::method". I send it here because fixing this could result in a hard to find BC break and it could be a good idea to handle this in 8.0. https://3v4l.org/NSdB8 class A {     static function call() {         self::method();         $self = self::class;         $self::method();     }     static function method() { echo static::class; } } class B extends A {} B::call(); // displays "BA" instead of "AA" In case this is "Not a Bug" please explain to me why the result of "self::method()" is different then "$self = self::class; $self::method();". Thanks, Marc