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

Commit 4fd017a

Browse files
committed
Merge pull request #25 from danizord/hotfix/avoid-filter-dependency
Avoid needless Zend\Filter dependency
2 parents 67c6ed9 + c454b3b commit 4fd017a

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/Renderer/PhpRenderer.php

+5-1
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

+10
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)