Re: [PHP-DEV] Bug Wrong resolution of "Late Static Binding" after self::method()

2020-03-09 Thread Marc
Thank you all for explaining. This helps a lot! Marc On 09.03.20 10:27, Rowan Tommins wrote: On Mon, 9 Mar 2020 at 05:38, Marc wrote: 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 exp

Re: [PHP-DEV] Bug Wrong resolution of "Late Static Binding" after self::method()

2020-03-09 Thread Rowan Tommins
On Mon, 9 Mar 2020 at 05:38, Marc wrote: > > 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" refer

Re: [PHP-DEV] Bug Wrong resolution of "Late Static Binding" after self::method()

2020-03-09 Thread Nikita Popov
On Mon, Mar 9, 2020 at 6:38 AM Marc wrote: > 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 a

Re: [PHP-DEV] Bug Wrong resolution of "Late Static Binding" after self::method()

2020-03-08 Thread 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

Re: [PHP-DEV] Bug Wrong resolution of "Late Static Binding" after self::method()

2020-03-08 Thread Matthew Brown
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 overr

Re: [PHP-DEV] Bug Wrong resolution of "Late Static Binding" after self::method()

2020-03-08 Thread Rowan Tommins
On 8 March 2020 09:47:37 GMT+00:00, Marc wrote: >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::

[PHP-DEV] Bug Wrong resolution of "Late Static Binding" after self::method()

2020-03-08 Thread 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