Issue Bug Accepted Orphaned

#104118Avoid hard dependency on final validation viewhelper

Andreas Kießling 06/15/24, 19:33 updated 03/26/25, 09:21

Description

I inherited a project that xclassed the NotEmptyViewHelper and am currently updating it to v12.4
Previously, the ViewHelper was extended, but since they are final now this can’t be done anymore.
Thus i copied the code over, made the adjustments —> done, or so i thought…

Now when i tried to add a new form with EXT:form, i could not get the required sign to show up. After quite some debugging i found that there are hard dependencies with instanceof checks in place
https://github.com/search?q=repo%3ATYPO3%2Ftypo3+%22instanceof+NotEmpty%22&type=code

https://github.com/TYPO3/typo3/blob/main/typo3/sysext/extbase/Classes/Validation/Validator/NotEmptyValidator.php

IMHO this implementation needs to be changed, we can not have any hardcoded checks that way without being able to switch out the code. I know that the final declaration is unlikely to change, thus the NotEmptyValidator should probably have an interface or tag to indicate it is a required validator.

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.

Fix this issue

Start the commit message of your patch with this. Add what the patch does, and the versions it goes to in "Releases:". How to create a patch

Commit message
[BUGFIX] Avoid hard dependency on final validation viewhelper Resolves: #104118 Releases: main