That specific error is due to the fact that when you use an array in a
foreach loop, PHP tries to update the internal pointer to the 'current'
key.  Since you cannot get the array by reference using __get or offsetGet,
you cannot update this pointer.  PHP is telling you that you are updating
the pointer and that it cannot save that result back into the original array
since the array that was updated is just a copy.  Anyway.  Long story short,
this will make the warning disappear:

$view->myvar = array(1, 2);

in the template

foreach ((array)$this->myvar as $key) {
}

Just type-cast the variable to an array (Yes, I know it is already an array)

Lee


On 12/28/06, Arnaud Limbourg <[EMAIL PROTECTED]> wrote:

Matthew Weier O'Phinney wrote:
> What version of ZF are you using? Zend_View_Abstract was modified just
> prior to 0.6.0 to extend ArrayObject to correct the very issue you're
> reporting (there are other issues now being reported as a result, but
> this isn't one of them).

It does work better but there is weird issue in that

$view->myvar = null;

will yield, in the template, var_dump(empty($this->myvar)); => false
whereas I expect empty to return true since it is null :)

Arnaud.

Reply via email to