Skip to content
This repository was archived by the owner on Jan 31, 2020. It is now read-only.

Commit bcd8149

Browse files
committed
Merge branch 'hotfix/25'
Close #25 Fixes #3 Fixes #12 Fixes #24
2 parents 67c6ed9 + a1da77c commit bcd8149

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ All notable changes to this project will be documented in this file, in reverse
1919

2020
### Fixed
2121

22-
- Nothing.
22+
- [#25](https://github.com/zendframework/zend-view/pull/25) updates
23+
`PhpRenderer::render()` to no longer lazy-instantiate a `FilterChain`;
24+
content filtering is now only done if a `FitlerChain` is already
25+
injected in the renderer.
2326

2427
## 2.5.2 - 2015-06-16
2528

src/Renderer/PhpRenderer.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,11 @@ public function render($nameOrModel, $values = null)
515515

516516
$this->setVars(array_pop($this->__varsCache));
517517

518-
return $this->getFilterChain()->filter($this->__content); // filter output
518+
if ($this->__filterChain instanceof FilterChain) {
519+
return $this->__filterChain->filter($this->__content); // filter output
520+
}
521+
522+
return $this->__content;
519523
}
520524

521525
/**

test/PhpRendererTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,4 +442,14 @@ public function testSharedInstanceHelper()
442442
$this->assertEquals(2, $this->renderer->sharedinstance());
443443
$this->assertEquals(3, $this->renderer->sharedinstance());
444444
}
445+
446+
public function testDoesNotCallFilterChainIfNoFilterChainWasSet()
447+
{
448+
$this->renderer->resolver()->addPath(__DIR__ . '/_templates');
449+
450+
$result = $this->renderer->render('empty.phtml');
451+
452+
$this->assertContains('Empty view', $result);
453+
$this->assertAttributeEmpty('__filterChain', $this->renderer);
454+
}
445455
}

0 commit comments

Comments
 (0)