Details
Description
In Zend_View_Smarty, when using an array append operation (eg. $view->myArray[] = 'foo'
the __get overload function produces this notice:
Notice: Indirect modification of overloaded property ...
To fix this you have to pass by reference - but the Zend_View_Interface/Zend_View_Abstract __get method doesn't pass by reference so I fixed it like this:
change:
public function __get($key) { return $this->_smarty->get_template_vars($key); }
to:
public function __get($key) { return is_array($this->_smarty->get_template_vars($key)) ? new ArrayObject($this->_smarty->get_template_vars($key)) : $this->_smarty->get_template_vars($key); }
I'm sure there's some way to make this more pretty by using a temp var or something, but I wanted it to be fast and simple.
OK, this get's rid of the notice but it still doesn't work (it doesn't append to the array still). Any ideas how to make this work right?