#19439 [Fbk->NoF]: reference to $this issue warning
| From: | php-bugs at lists dot php dot net | Date: | Sun, 29 Dec 2002 07:00:06 +0000 |
| Subject: | #19439 [Fbk->NoF]: reference to $this issue warning | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-28650@lists.php.net to get a copy of this message | ||
ID: 19439
Updated by: php-bugs@lists.php.net
Reported By: kylam@superapple.org
-Status: Feedback
+Status: No Feedback
Bug Type: Scripting Engine problem
Operating System: Windows 2000
PHP Version: 4.2.3
New Comment:
No feedback was provided for this bug for over 2 weeks, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
Previous Comments:
------------------------------------------------------------------------
[2002-12-08 10:51:59] sniper@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php4-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php4-win32-latest.zip
Can't reproduce with PHP 4.3.0-dev. Although I might have misunderstood
what script actually is causing it. If it still happens with the latest
snapshot, please include a really NOT working example script here.
------------------------------------------------------------------------
[2002-09-16 12:59:08] kylam@superapple.org
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.
:)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=19439&edit=1