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

Commit e2e6acc

Browse files
committed
Merge branch 'hotfix/121'
Close #121 Fixes #120
2 parents 449c4d9 + c1525d4 commit e2e6acc

File tree

5 files changed

+37
-1
lines changed

5 files changed

+37
-1
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ cache:
1515

1616
env:
1717
global:
18+
- COMPOSER_PROCESS_TIMEOUT=600
1819
- COMPOSER_ARGS="--no-interaction"
1920
- COVERAGE_DEPS="satooshi/php-coveralls"
2021
- LEGACY_DEPS="phpunit/phpunit"

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ All notable changes to this project will be documented in this file, in reverse
2929
`Exception` instances, but also PHP 7 `Throwable` instances, and properly
3030
cleanup the output buffers when it does.
3131

32+
- [#121](https://github.com/zendframework/zend-view/pull/121) provides a fix to
33+
ensure that content generated on a previous execution of `PhpRenderer::render()`
34+
is never re-used.
35+
3236
## 2.9.0 - 2017-03-21
3337

3438
### Added

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
"minimum-stability": "dev",
6262
"prefer-stable": true,
6363
"config": {
64-
"sort-packages": "true"
64+
"sort-packages": true
6565
},
6666
"extra": {
6767
"branch-alias": {

src/Renderer/PhpRenderer.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,7 @@ public function render($nameOrModel, $values = null)
491491
extract($__vars);
492492
unset($__vars); // remove $__vars from local scope
493493

494+
$this->__content = '';
494495
while ($this->__template = array_pop($this->__templates)) {
495496
$this->__file = $this->resolver($this->__template);
496497
if (! $this->__file) {

test/PhpRendererTest.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,4 +481,34 @@ public function testDoesNotCallFilterChainIfNoFilterChainWasSet()
481481
$this->assertContains('Empty view', $result);
482482
$this->assertAttributeEmpty('__filterChain', $this->renderer);
483483
}
484+
485+
/**
486+
* @group zend-view-120
487+
* @see https://github.com/zendframework/zend-view/issues/120
488+
*/
489+
public function testRendererDoesntUsePreviousRenderedOutputWhenInvokedWithEmptyString()
490+
{
491+
$this->renderer->resolver()->addPath(__DIR__ . '/_templates');
492+
493+
$previousOutput = $this->renderer->render('empty.phtml');
494+
495+
$actual = $this->renderer->render('');
496+
497+
$this->assertNotSame($previousOutput, $actual);
498+
}
499+
500+
/**
501+
* @group zend-view-120
502+
* @see https://github.com/zendframework/zend-view/issues/120
503+
*/
504+
public function testRendererDoesntUsePreviousRenderedOutputWhenInvokedWithFalse()
505+
{
506+
$this->renderer->resolver()->addPath(__DIR__ . '/_templates');
507+
508+
$previousOutput = $this->renderer->render('empty.phtml');
509+
510+
$actual = $this->renderer->render(false);
511+
512+
$this->assertNotSame($previousOutput, $actual);
513+
}
484514
}

0 commit comments

Comments
 (0)