Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:108899 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 43979 invoked from network); 8 Mar 2020 18:34:26 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 8 Mar 2020 18:34:26 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id C2CB91804E6 for ; Sun, 8 Mar 2020 09:54:52 -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.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,MIME_QP_LONG_LINE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-yw1-f43.google.com (mail-yw1-f43.google.com [209.85.161.43]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sun, 8 Mar 2020 09:54:52 -0700 (PDT) Received: by mail-yw1-f43.google.com with SMTP id t141so7643054ywc.11 for ; Sun, 08 Mar 2020 09:54:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=content-transfer-encoding:from:mime-version:subject:date:message-id :references:cc:in-reply-to:to; bh=qld4psAi0SBER4VFdLrkB6mbVarCQB1s9DecMnHF41k=; b=Ycek875nUFXdcXRGJx2CdEOcUy1K7Uj6UQyLYz/5s+aDI4+u7avFj8r+YMQEoygHP0 wEezz8KI+DdeQi0iJsRmlKI3+89r1iyZwX9hmDMWqXuzBna8JVR8754F89KqhGTE4yN4 LqVjMResj+W410z7ctkEMRo9xm8jCrletEGon0iewHrOP4Nhws3IEdrfkF0P1smn63Qi fbX+tBOYjBE8vsz9xiOcdAualCwx2S/A0gWLCxRIn8GUN3NjIG/nU5M7AC28Fdf7Gy0R ntm8IS0f04pxEm/Gk9GrCbAmQrQk5Oi3l9QoAVm5MyjKShK7bV0P6ckTHy0DUWHVZeOK xCGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:content-transfer-encoding:from:mime-version :subject:date:message-id:references:cc:in-reply-to:to; bh=qld4psAi0SBER4VFdLrkB6mbVarCQB1s9DecMnHF41k=; b=A5M1K8Rhbhphb8BlCnY0Nm2PtVo0q/HkpKdttEP7sWN9C0E3Rb5/LBnDOSocogBka9 NXJIZCbsrvRxup0bfhj2W2WkfompUHICI+d9J8zNKvtbp5WzjLIiYtbyD5tc05YvKADR GbsC/SQnav2jeITphy0avalN/tE0MHobM4F838GSpSnfgqa7S6cTZLxGLfjsLxc51p5F Y0EGVQexS+JqLKHAzdS8EroNQeRcpmPEFOGni5Psj3ej8Brd8Z7JQSlmmCGoAchN59zB ZsUre7ouDtG+8uqs1u88V23bWoJvB0L7bSrQw2cU6LwpRo2GQZ52hMYEkSqjj7cAkVwE qReg== X-Gm-Message-State: ANhLgQ0LfKfAkMyIbVDXBWs66ZupyB3m2jyROrKiwxrZWDrriE3rbtWN D5jFMKxBgMpOFEjamHbT+ppirjyz X-Google-Smtp-Source: ADFU+vvViDUstbN9ZNwmN+1okvtRk+dX0/2dpo8otyF9K/3qGgHdhnOadP4TfYDKvFQFCtKQdVrcQw== X-Received: by 2002:a25:ad4c:: with SMTP id l12mr13732802ybe.130.1583686488184; Sun, 08 Mar 2020 09:54:48 -0700 (PDT) Received: from ?IPv6:2600:380:6838:e86f:1157:7236:c311:194b? ([2600:380:6838:e86f:1157:7236:c311:194b]) by smtp.gmail.com with ESMTPSA id d192sm2205863ywe.76.2020.03.08.09.54.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 08 Mar 2020 09:54:47 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (1.0) Date: Sun, 8 Mar 2020 11:54:46 -0500 Message-ID: <4D79715B-D9F8-42F8-B0DB-4EA7B6DBFB6A@gmail.com> References: <1845472b-08ab-bb31-dc77-23c620b8d217@mabe.berlin> Cc: internals@lists.php.net In-Reply-To: <1845472b-08ab-bb31-dc77-23c620b8d217@mabe.berlin> To: Marc X-Mailer: iPhone Mail (17D50) Subject: Re: [PHP-DEV] Bug Wrong resolution of "Late Static Binding" after self::method() From: matthewmatthew@gmail.com (Matthew Brown) This is expected behaviour given my understanding of how late static binding= works: If there is a chain of =E2=80=9Cself::=E2=80=9D calls that ultimately ends i= n =E2=80=9Cstatic::someMethod=E2=80=9D, then PHP behaves as if every precedi= ng call was a call to =E2=80=9Cstatic::=E2=80=9D, not =E2=80=9Cself::=E2=80=9D= . In your second call you=E2=80=99re explicitly overriding that resolution b= y changing using (self::class)::someMethod, which PHP always treats as A::so= meMethod, thus producing the expected output. > On Mar 8, 2020, at 4:48 AM, Marc wrote: >=20 > =EF=BB=BFHi, >=20 > I have reported a bug in Mai 2019 but did not get any response here https:= //bugs.php.net/bug.php?id=3D77985. >=20 >=20 > The problem is that "static::class" as well as "get_called_class()" used w= ithin 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 w= ith "ClassName::method". >=20 >=20 > 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. >=20 >=20 > https://3v4l.org/NSdB8 >=20 > class A { > static function call() { > self::method(); >=20 > $self =3D self::class; > $self::method(); > } > static function method() { echo static::class; } > } >=20 > class B extends A {} >=20 > B::call(); // displays "BA" instead of "AA" >=20 >=20 > In case this is "Not a Bug" please explain to me why the result of "self::= method()" is different then "$self =3D self::class; $self::method();". >=20 >=20 > Thanks, >=20 > Marc >=20 > --=20 > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php >=20