zendframework/zf2 — pull request #722 by juriansluiman (2012-01-11 14:05:15+00:00)
Title: Stop cloning Zend\View when Partial is invoked

As per IRC discussion with @weierophinney, this PR stops cloning `Zend\View` when the `Zend\View\Helper\Partial` is used.

The variable container is cleared from its variables and restored when the view script has
been rendered. This makes the helper more lightweight as setting variables is faster than
cloning the complete view object.

**Please note** this PR is **not ready yet** but I'd like to open discussion. `Zend\View\Variables` contains all view variables in a escaped or non-escaped form. `Zend\View\Variables::getArrayCopy()` returns these variables, `Zend\View\Variables::getRawValues()` get all raw values. For the setters, with `Zend\View\Variables::assign()`, `Zend\View\Variables::offsetSet()` and `Zend\View\Variables::setCleanValue()` is there currently no way to set the ArrayObject and raw values independently. Something like this seems nonsense, just to make sure the raw values are set as well as the (non)escaped values:

```php
foreach ($raws as $key => $value) {
$container->setCleanValue($key, $value);
}
$container->exchangeArray($vars);
```
A method `Zend\View\Variables::setRawValues()` looks too specific for this use case, as its not setting any variables in the array object but stores only the raw variants.