BUGFIX: Prevent infinite recursion in form element node label - #160
Open
signalwerk wants to merge 1 commit into
Open
signalwerk wants to merge 1 commit into
signalwerk wants to merge 1 commit into
Conversation
The label expression of `Neos.Form.Builder:FormElement` fell back to `Neos.Node.label(node)`. On Neos 9 that helper delegates to `DelegatingNodeLabelRenderer`, which evaluates the node type's own label expression again - so the expression calls itself until PHP aborts with "Maximum call stack size reached. Infinite recursion?". Every form element without an identifier and without a label is affected; `StaticText` and `Section` disable the `IdentifierMixin`. As the content tree renders a label for every node of a document, the `/neos/ui-services/flow-query` request fatals and the Neos UI content tree keeps spinning, leaving the document uneditable. Use the fallback the core renders for node types without a label expression instead: the node type name, plus the node name in parentheses when the node has one.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Neos.Form.Builder:FormElementfalls back toNeos.Node.label(node)when neitheridentifiernorlabelis set:On Neos 9 that helper delegates to
DelegatingNodeLabelRenderer, which looks up the node type's ownlabelconfiguration and evaluates this very expression again — unbounded recursion until PHP aborts withMaximum call stack size … reached. Infinite recursion?. (The renderer guards against this forlabel.generatorClass, but not for the expression case.)StaticTextandSectionset'Neos.Form.Builder:IdentifierMixin': false, so any of them without an explicit label triggers it. Since the content tree renders a label for every node of the selected document,POST /neos/ui-services/flow-queryfatals — a stack overflow, so no error page either — and the Neos UI content tree keeps spinning. The document cannot be edited at all.Fix
Drop the self-referential call and inline the fallback the core itself uses for node types without a label expression (the anonymous generator in
DelegatingNodeLabelRenderer::getDelegatedGenerator()):This also repairs the concatenation itself: on Neos 9
node.nodeTypeNameandnode.nameare value objects, andnode.nameisnullfor non-autocreated nodes.Verified on Neos 9.1.5 / form-builder 3.0.5: labels for a document containing a form render again, elements that do have an identifier or a label are unchanged.
Note
This patch was written by an LLM (Claude), then verified against a Neos 9.1.5 installation. Please feel free to change the fallback, the comment or the wording if you prefer something else — the point is only to break the recursion.