Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
kitzberger opened this issue Mar 18, 2025 · 0 comments · May be fixed by #1942
Open

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

kitzberger opened this issue Mar 18, 2025 · 0 comments · May be fixed by #1942

Comments

@kitzberger
Copy link

kitzberger commented Mar 18, 2025

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
@kitzberger kitzberger linked a pull request Mar 18, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant