From:             tater at potatoe dot com
Operating system: *
PHP version:      5CVS-2003-08-13 (dev)
PHP Bug Type:     Zend Engine 2 problem
Bug description:  methods called w call_user_func have no $this

Description:
------------
If you call an object's method, $x->foo(), and then
call parent:;bar() (or self:;bar() or xyz::abc()),
$this will be defined inside bar() and point to the
original object ($x). But if you use call_user_func()
or call_user_func_array(), $this is not defined.


Reproduce code:
---------------
class foo
{
        function a()
        {
                if (isset($this))
                        var_dump($this);
                else
                        print "\$this not defined.\n";
        }
        function b()
        {
                self::a();
                call_user_func(array('self','a'));
        }
}
$x = new foo;
$x->b();

Expected result:
----------------
object(foo)#1 (0) {
}
object(foo)#1 (0) {
}

Actual result:
--------------
object(foo)#1 (0) {
}
$this not defined.

-- 
Edit bug report at http://bugs.php.net/?id=25069&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=25069&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=25069&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=25069&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=25069&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=25069&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=25069&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=25069&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=25069&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=25069&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=25069&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=25069&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=25069&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=25069&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=25069&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=25069&r=gnused

Reply via email to