ID:               38697
 Updated by:       [EMAIL PROTECTED]
 Reported By:      totol at tele2 dot fr
-Status:           Open
+Status:           Bogus
 Bug Type:         Class/Object related
 Operating System: Windows XP
 PHP Version:      4.4.4
 New Comment:

PHP4:
hello
Notice: Undefined variable:  this in /tmp/2.php on line 14

PHP5:

Strict Standards: Non-static method myClass2::method() should not be
called statically, assuming $this from incompatible context in
/tmp/2.php on line 6
hello
Strict Standards: Non-static method myClass2::method() cannot be called
statically in /tmp/2.php on line 9

Strict Standards: Non-static method myClass2::method() cannot be called
statically in /tmp/2.php on line 9


Previous Comments:
------------------------------------------------------------------------

[2006-09-03 08:52:11] totol at tele2 dot fr

Description:
------------
if you call a static method with call_user_func in an object, you don't
have access to var of the caller object, see code bellow

Reproduce code:
---------------
class myClass {
   var $myVar="hello";
   function staticCall(){
       myClass2::method();
   }
   function calluserCall(){
       call_user_func(array('myClass2','method'));
   }
}
class myClass2{
    function method(){
       echo $this->myVar;
    }
}
$test=new myclass();
$test->staticCall();    //return 'hello'
$test->calluserCall();   //return nothing


Expected result:
----------------
$test->staticCall();    //return 'hello'


$test->calluserCall();   //return nothing




------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=38697&edit=1

Reply via email to