Skip to content

BUG: v:try render() vs. renderStatic() #1941

@kitzberger

Description

@kitzberger

I have checked that the bug exists in the dev-development branch
Yes

I have checked that there are no already open issues or recently closed issues about this bug
Yes

Describe the bug

The viewhelper v:try behaves differently when cached than when uncached.

The docs on this viewhelper indicates that f:then is optional, but it seems to me like it's not.

To Reproduce

	<v:try>
		<f:then>THEN_1</f:then>
		<f:else>ELSE_1</f:else>
	</v:try>
	<v:try>
		THEN_2
		<f:else>ELSE_2</f:else>
	</v:try>

Expected behavior

Always:

THEN_1 THEN_2

Actual behavior

Uncached Cached
THEN_1 ELSE_1 THEN_2 ELSE_2 THEN_1 ELSE_2
Both blocks of both examples are being rendered! That's broken. THEN_1 is correct. ELSE_2 isn't though!

It's two problems I reckon:

  • For uncached calls: TryViewHelper->render() calls renderChildren() instead of renderThenChild(), so both blocks are being rendered.
  • For cached calls: TryViewHelper::renderStatic() tries to access $arguments['__then']() without "isset" beforehand (which triggers an Exception due to a PHP 8 warning, which will then render the "else part".

Additional context

  • PHP 8.1
  • TYPO3 11.5
  • EXT:vhs 7.1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions