note 84647 added to function.call-user-func-array
| From: | yannick at myconcept dot be | Date: | Wed, 23 Jul 2008 15:08:32 +0000 |
| Subject: | note 84647 added to function.call-user-func-array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-142611@lists.php.net to get a copy of this message | ||
I use the magic autoload function to load my classes and put an error handler on my autoload to log
load errors... I've got some weird traces : unknown load attempts due to the combination of
call_user_func_array & __autoload... PHP try to load 5 or 6 times the autoload class with very
strange class names... A call_user_func_array will call 5 times autoload before
'triggering' a warning... I someone knows how to avoid those attempts...
Ex :
"
class xbbe9xrngdvxqh{
public function MyMethod(){
echo 'Hello world !';
}
}
class MyWorkingClass {
//Error will call xbbe9xrngdvxqh
}
function __autoload($class){
echo 'Loading class '.$class.'<br>';
}
call_user_func_array(array('MyClass','MyMethod'),false);
call_user_func_array(array('WS_Auth','MyMethod'),false);
call_user_func_array(array('MyTestClass','MyMethod'),false);
call_user_func_array(array('MyWorkingClass','MyMethod'),false);
"
Will return :
Loading class MyClass
Loading class 3ziu1ci
Loading class MyClass
Loading class 3ziu1ci
Loading class MyClass
Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a
valid callback, 'MyClass::MyMethod' was given in \Yannick\Projets\bug_php_autoload.php on
line 13
Loading class WS_Auth
Loading class 5e95664
Loading class WS_Auth
Loading class 5e95664
Loading class WS_Auth
Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a
valid callback, 'WS_Auth::MyMethod' was given in \Yannick\Projets\bug_php_autoload.php on
line 14
Loading class MyTestClass
Loading class wepkt0wxpp9
Loading class MyTestClass
Loading class wepkt0wxpp9
Loading class MyTestClass
Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected
to be a valid callback, 'MyTestClass::MyMethod' was given in
Yannick\Projets\bug_php_autoload.php on line 15
Hello world !
----
Server IP: 195.207.10.20
Probable Submitter: 80.200.191.194
----
Manual Page -- http://www.php.net/manual/en/function.call-user-func-array.php
Edit -- https://master.php.net/note/edit/84647
Del: integrated -- https://master.php.net/note/delete/84647/integrated
Del: useless -- https://master.php.net/note/delete/84647/useless
Del: bad code -- https://master.php.net/note/delete/84647/bad+code
Del: spam -- https://master.php.net/note/delete/84647/spam
Del: non-english -- https://master.php.net/note/delete/84647/non-english
Del: in docs -- https://master.php.net/note/delete/84647/in+docs
Del: other reasons-- https://master.php.net/note/delete/84647
Reject -- https://master.php.net/note/reject/84647
Search -- https://master.php.net/manage/user-notes.php