#1 passing static class method as a callback is not supported

open
nobody
None
5
2009-12-11
2009-12-11
No

Hi there

I've added a static member to my class and passed it to the action_function as "MyClass::MyMethod". I changed code to suit my needs and it would be nice to have this working in the next releases ;) The code after the fix looks like this (the very beginning of the processMailbox() method):
function processMailbox($max=false) {
$meth = explode('::', $this->action_function);
if ( empty($this->action_function) || !(function_exists($this->action_function) || count($meth) > 1 && method_exists($meth[0], $meth[1])) ) {
$this->error_msg = 'Action function not found!';
$this->output();
return false;
}
// other code w/o changes goes here
}

Regards,
Alex Novikov

Discussion

  • Anthon Pang

    Anthon Pang - 2012-03-27

    I think it would be simpler to use is_callable().

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks