Pass-by-Reference Error

Posted by TK on Stack Overflow See other posts from Stack Overflow or by TK
Published on 2010-03-21T11:01:34Z Indexed on 2010/03/21 11:11 UTC
Read the original article Hit count: 589

Filed under:
|
|
|

I have a hook system setup... which is working on localhost... I put it live and get an error saying "Warning: Call-time pass-by-reference has been deprecated".

Now, apparently the work around is to remove all "&" from your function calls, ie foo(&$me) to foo($me) and then in foo's function definition do "function foo(&$me)".

However, I can not do this... because my hooks accept an array as arguments, I need a work around for this. Like I can use "run_hooks ( 'hook-name', $me );" or "run_hooks ( 'hook-name', array ( $me, $another_var, etc... ) )";

So this means I can not use "function run_hooks ( $hook_name, &$arguments )" because I'll get an error in php saying it can not pass "array()" as reference...

Any ideas an a work around?

Thanks.

© Stack Overflow or respective owner

Related posts about hooks

Related posts about arrays