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

Commit

Permalink
Merge branch 'hotfix/25' into develop
Browse files Browse the repository at this point in the history
Forward port #25
  • Loading branch information
weierophinney committed Jan 19, 2016
2 parents 82c537d + a1da77c commit 392794d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ All notable changes to this project will be documented in this file, in reverse

### Fixed

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

## 2.5.2 - 2015-06-16

Expand Down
6 changes: 5 additions & 1 deletion src/Renderer/PhpRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,11 @@ public function render($nameOrModel, $values = null)

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

return $this->getFilterChain()->filter($this->__content); // filter output
if ($this->__filterChain instanceof FilterChain) {
return $this->__filterChain->filter($this->__content); // filter output
}

return $this->__content;
}

/**
Expand Down
10 changes: 10 additions & 0 deletions test/PhpRendererTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -464,4 +464,14 @@ public function testSharedInstanceHelper()
$this->assertEquals(2, $this->renderer->sharedinstance());
$this->assertEquals(3, $this->renderer->sharedinstance());
}

public function testDoesNotCallFilterChainIfNoFilterChainWasSet()
{
$this->renderer->resolver()->addPath(__DIR__ . '/_templates');

$result = $this->renderer->render('empty.phtml');

$this->assertContains('Empty view', $result);
$this->assertAttributeEmpty('__filterChain', $this->renderer);
}
}

0 comments on commit 392794d

Please sign in to comment.