|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19439 reference to $this issue warning
Submitted: 2002-09-16 12:59 UTC Modified: 2002-12-29 01:00 UTC
From: kylam at superapple dot org Assigned:
Status: No Feedback Package: Scripting Engine problem
PHP Version: 4.2.3 OS: Windows 2000
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2002-09-16 12:59 UTC] kylam at superapple dot org
Here are two classes:
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

$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.



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-12-08 10:51 UTC]
Please try using this CVS snapshot:
For Windows:

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-12-29 01:00 UTC] php-bugs at lists dot php dot net
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".
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Wed Dec 07 03:05:52 2022 UTC