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

Commit 43f0a99

Browse files
committed
Merge branch 'hotfix/121' into develop
Forward port #121
2 parents 93e048d + c1525d4 commit 43f0a99

File tree

5 files changed

+37
-1
lines changed

5 files changed

+37
-1
lines changed

.travis.yml

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

+4
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ All notable changes to this project will be documented in this file, in reverse
4747
`Exception` instances, but also PHP 7 `Throwable` instances, and properly
4848
cleanup the output buffers when it does.
4949

50+
- [#121](https://github.com/zendframework/zend-view/pull/121) provides a fix to
51+
ensure that content generated on a previous execution of `PhpRenderer::render()`
52+
is never re-used.
53+
5054
## 2.9.0 - 2017-03-21
5155

5256
### Added

composer.json

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

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

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