#20760 : is it really the intended behavior ?

php.internals

Mehdi Achour

22 years ago
Hi internals, Trying to close some documentation bugs, I saw #20760. Here's the problem : class Foo { var $bla; function quux() { $this->bla = 5; } } class Bar { var $bla; function do_stuff() { $this->bla = 10; Foo::quux(); echo $this->bla; } } $blabla = new Bar; $blabla->do_stuff(); // will print 5, Foo::$bar value Derick claimed that it was an intended behavior, I'd like to make sure before documenting it. I'd also like to know why do we have this feature ? It's quiet confusing. Thank you in advance, Mehdi Achour

Sara Golemon

22 years ago
> Derick claimed that it was an intended behavior, I'd like to > make sure before documenting it. I'd also like to know why > do we have this feature ? It's quiet confusing. >
You would doubt Derick? Shame! Yes, this is intended behavior, primarily to allow children to call parents staticly and still have $this available for parents to modify properties. The fact that it works across non-relatives is simply a side-effect. -Sara