Project

General

Profile

Actions

Bug #67945

closed

Condition ViewHelper not evaluated correctly

Added by Philipp Wrann over 8 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
Fluid
Target version:
Start date:
2015-07-07
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
7
PHP Version:
5.6
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

Simple Setup:

This is my fluid template:

<p:frontPage>
<f:then>
    <div class="header-slideshow">
        <f:cObject typoscriptObjectPath="lib.renderContent" data="{uid:55}"/>
    </div>
</f:then>
<f:else>
    FOO
</f:else>
</p:frontPage>

The viewhelper is very simple and makes basically this:

return ((integer) $GLOBALS['TSFE']->page['is_siteroot'] === 1) ? $this->renderThenChild() : $this->renderElseChild();

On first page load the viewhelper is called 2 times (?) I can see that because i put some debug outputs there.

On the secod load the viewhelper returns the Else child. But if i debug the condition

var_dump((integer) $GLOBALS['TSFE']->page['is_siteroot'] === 1);

It allways says TRUE

Anyway

"FOO" is printed from the second run onwards.

HEAD is @ 89139e8

Actions #1

Updated by Philipp Wrann over 8 years ago

I think the problem might is the fact, that my viewhelper does not need a condition argument, but

AbstractConditionViewHelper::renderStatic calls static::evaluateCondition and returns FALSE if $arguments['condition'] is not set.

I would suggest to implement the CompilableInterface only in the concrete Fluid\IfViewHelper, not in the AbstractConditionViewHelper, this might break many applications.

I overruled the static renderStatic method in my viewhelper to fix the issue in my case.

Actions #2

Updated by Claus Due over 8 years ago

This is the new inner API of AbstractConditionViewHelper; implemented to make all of them compilable. It certainly has broken a lot of applications - see for example the VHS extension which required a massive effort to make all condition ViewHelpers compatible with both the old and new API.

This issue can be closed - it's "by design" and "won't fix" :)

Actions #3

Updated by Claus Due over 8 years ago

  • Status changed from New to Closed
Actions

Also available in: Atom PDF