call_user_func(_array) behaviour in PHP 5.3

Before PHP 5.3 you could use call_user_func and call_user_func_array even if you didnt provide an array with parameters. Since 5.3, this results in a ‘NULL’ without actually executing this method/function.

// works in < 5.3, but fails in > 5.3
$moduleItems = call_user_func_array(array($className, ‘getByTag’), $this->id);

// works everywhere
$moduleItems = call_user_func(array($className, ‘getByTag’), $this->id);

In all honesty, it’s normal that it shouldn’t work when you don’t provide the right parameters. However a decent notice would let me know that something is wrong.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Post Navigation