#348 Allow preload item methods to be called as instance methods

XOOPS_2.4
open
D.J.
Core (214)
6
2012-09-25
2010-06-04
K.Ono
No

Currently, preload item methods are called as static methods only but the following change will
allow them to be called as instance methods as well without breaking compatiblity.

htdocs/class/preload.php on line 118

$event= array('class_name' => $class_name, 'method' => $method);

change the above line to

$event= array('class_name' => new $class_name, 'method' => $method);

Using 2.4.5RC2

Discussion

  • K.Ono

    K.Ono - 2010-06-04

    Oops, didn't realize 2.4 still supports PHP4.
    Here is the one for both PHP4/5.

    htdocs/class/preload.php on line 118:

    $event= array('class_name' => new $class_name, 'method' => $method);

    to

    $obj = new $class;
    $event= array('class_name' => &$obj, 'method' => $method);

    on line 139 of the same file:

    call_user_func(array($event['class_name'], $event['method']), $args);

    to

    call_user_func($event, $args);

    Haven't tested yet with PHP4, but hope this should work fine.

    Also any reason why using call_user_func() instead of call_user_func_array() when triggering events?

     
  • D.J.

    D.J. - 2010-06-04

    OK, I'll take care of this one personally.

     

Log in to post a comment.

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

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks