All about a Zend Application with an action helper.
I want to unset some pairs of an array by a function.
helper:
class Application_Controller_Action_Helper_TestHelper extends Zend_Contr[...]
{
public function direct(&$array)
{
if(isset($array['key']))
unset($array['key']);
}
}
controller:
$this->_helper->TestHelper($var);
How could I get it working?
You must also pass it as reference:
$this->_helper->TestHelper(&$var);UPDATE:
Ups, I had my errors turned off. You (and now me) are getting the error because…
ZF’s HelperBroker uses
return call_user_func_array(array($helper, 'direct'), $args);to call your direct() method. Check the docs, but it seemscall_user_func_arraypasses by reference, although with several quirks.Check out this answer.