Review 12.4 Abandoned

87086[BUGFIX] Cast tag-content of several ViewHelpers to string

Garvin Hicking CR 0 V 0 Hard +417 −17 updated 11/19/24, 17:48

Commit message

Several Fluid ViewHelpers used the method:

```
$this->tag->setContent($this->renderChildren());
```

However, in many cases specifying an integer as a tag content (for
example in pagination cases) is valid:

```
<f:for each="{1:'step1', 2:'step2'}"
       as='i'
       iteration='iterator'
       key="k">
    <f:link.action action="{i}">{k}</f:link.action>
</f:for>
```

This would lead to an exception, because the `setContent()` method
expects a a string.

Several ViewHelpers have now been adapted to cast the result of
`renderChildren` to a string.

Tests verifying this behaviour are added. Some cases where ViewHelpers
already had string-casting in effect are now secured with a test, too.

Notable exemptions of ViewHelpers where no string casting has been
applied:

- EXT:form VHs already seem to take care of proper renderChildren()
  handling.
- f:uri.action and f:uri.page do not accept tag based content.
- ce:link.clickEnlarge, sg:example, sg:code, sg:colorscheme do
  not make sense to receive non-string input, exceptions still

Note that for <dashboard:widget.button> no functional test exists yet,
and is beyond scope of this patch to be added.

Drive-by fix of adding (string) cast to an integer-based
'title' attribute for <f:be.infobox> added as well.

Review

  • Code review CR 0
  • Verified V 0

Issues 1

Files 39

Show 19 more files

Review log 610

  1. Garvin Hicking commented on patch set 1 11/19/24, 16:48

    Cherry Picked from branch main. The following files contain Git conflicts: * typo3/sysext/fluid/Classes/ViewHelpers/Be/InfoboxViewHelper.php * typo3/sysext/fluid/Tests/Functional/ViewHelpers/Asset/ScriptViewHelperTest.php * typo3/sysext/fluid/Tests/Functional/ViewHelpers/FlashMessagesViewHelperTest.php * typo3/sysext/fluid/Tests/Functional/ViewHelpers/Form/Select/OptionViewHelperTest.php
  2. core-ci voted on patch set 1 V -1 11/19/24, 16:53 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/69724

  3. Garvin Hicking uploaded patch set 2 V -1 11/19/24, 16:57

    address merge conflict
  4. Garvin Hicking uploaded patch set 3 11/19/24, 17:01

    Adjust FlashMessagesViewHelperTest
  5. core-ci voted on patch set 2 V -1 11/19/24, 17:05 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/69727

  6. core-ci voted on patch set 3 V -1 11/19/24, 17:08 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/69728

  7. Garvin Hicking uploaded patch set 4 V -1 11/19/24, 17:22

    Adjust to v12 tests
  8. Garvin Hicking marked it ready for review 11/19/24, 17:23

  9. core-ci voted on patch set 4 V -1 11/19/24, 17:30 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/69729

  10. Garvin Hicking abandoned the change 11/19/24, 17:48

    Does not apply to 12.4