|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-09-09 10:27 UTC] jani@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 30 23:00:01 2025 UTC |
Description: ------------ When a function in a class is not declared static it can still be called as a static method (no problem). When this is done from another class the function seems to know the values from the class that it was called from. It is not clarified in the manual why this should be the case ($this is bound to class A, not class B) if this isn't a bug. Reproduce code: --------------- class A { function __construct() { $this->name = "Class A"; } function doeIets() { B::doeIetsAnders(); } } class B { function doeIetsAnders() { print_r($this); } } Expected result: ---------------- In strict mode, there should be a warning that $this does not have a value. Actual result: -------------- $this has te values of class A.