|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2002-12-08 10:51 UTC] sniper@php.net
[2002-12-29 01:00 UTC] php-bugs at lists dot php dot net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 03 19:00:02 2025 UTC |
Here are two classes: <?php class myBase { function g() { return 'haha'; } function output() { $x = new myBar($this); echo $this->g(); } } class myBar { var $container; function myBar(&$obj) { $this->container = $obj; } } // this work echo myBase::g(); ?> But when I copy the code of myBase::output() method outside the class defination, without changing the reference to $this variable passed to '$x = new myBar($this)' carelessly, that is <?php $x = new myBar($this); echo myBase::g(); // this issue warning ?> PHP gives a message to me: Warning: Problem with method call - please report this bug in xxx on line xx It should not be a normal case to work with $this outside a class, but as the message 'define' this as a bug, I just drop a message here. :)