|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-09-04 08:36 UTC] tony2001@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 16:00:02 2025 UTC |
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