FIX: Regression with <% with / %> (fixes #5656)

This commit is contained in:
Loz Calver 2016-06-06 10:14:07 +01:00
parent 8a99b4f74e
commit 946495bcf5
No known key found for this signature in database
GPG Key ID: F91FFC2D7E0CAEDB
3 changed files with 24 additions and 6 deletions

View File

@ -0,0 +1 @@
$Title<% with $Item %> - <% with $Up %>$Title<% end_with %> - <% with $NestedItem %><% with $Top %>$Title<% end_with %><% end_with %><% end_with %>

View File

@ -726,6 +726,16 @@ after')
'A - B - C - B - A'
);
$this->assertEquals(
$this->render('<% include SSViewerTestIncludeScopeInheritanceWithUpAndTop Title="A" %>',
new ArrayData(array(
'Item' => new ArrayData(array(
'Title' =>'B', 'NestedItem' => new ArrayData(array('Title' => 'C'))
)))
)),
'A - A - A'
);
$data = new ArrayData(array(
'Nested' => new ArrayData(array(
'Object' => new ArrayData(array('Key' => 'A'))

View File

@ -558,12 +558,15 @@ class SSViewer_DataPresenter extends SSViewer_Scope {
*/
public function pushScope() {
$scope = parent::pushScope();
$upIndex = $this->getUpIndex();
$itemStack = $this->getItemStack();
$itemStack[$this->getUpIndex()][SSViewer_Scope::ITEM_OVERLAY] = $this->overlay;
if ($upIndex !== null) {
$itemStack = $this->getItemStack();
$itemStack[$upIndex][SSViewer_Scope::ITEM_OVERLAY] = $this->overlay;
$this->setItemStack($itemStack);
$this->overlay = array();
$this->setItemStack($itemStack);
$this->overlay = array();
}
return $scope;
}
@ -575,8 +578,12 @@ class SSViewer_DataPresenter extends SSViewer_Scope {
* @return SSViewer_Scope
*/
public function popScope() {
$itemStack = $this->getItemStack();
$this->overlay = $itemStack[$this->getUpIndex()][SSViewer_Scope::ITEM_OVERLAY];
$upIndex = $this->getUpIndex();
if ($upIndex !== null) {
$itemStack = $this->getItemStack();
$this->overlay = $itemStack[$this->getUpIndex()][SSViewer_Scope::ITEM_OVERLAY];
}
return parent::popScope();
}