BUGFIX: Handle numeric node aggregate ids when building NodeAggregates#5727
Open
BUGFIX: Handle numeric node aggregate ids when building NodeAggregates#5727
NodeAggregates#5727Conversation
…ction `fromArray` is not safe and throws when constructed with ["a", "123"]: > Fatal error: Cannot use positional argument after named argument during unpacking Because we pass the indexed array as spread to the constructor
Type error: Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId::fromString(): Argument neos#1 ($value) must be of type string, int given, called in Packages/Neos/Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Repository/NodeFactory.php on line 290 A classic one thanks due to phps type casting for numeric array keys :) $array['123'] will be stored as int `123` and not accessible via `"123"`
…acter
The SubtreeTag value "456" does not adhere to the regular expression "/^[a-z_.-][a-z0-9_.-]{0,35}$/"
Otherwise fetching a node being tagged like this crashed in the NodeFactory in 323 because we
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.
Currently by not restricting numeric values like
"132"in the NodeAggregateId validation we allow it. Yet the behaviour is utterly broken due to us being tricked by phps "feature" which converts numeric strings to integers when using it as array index. We often put node ids into a hashmap but get integers back and then fail recreating a node aggregate id and other funky cases. I hope i found all cases...Type error: Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId::fromString(): Argument #1 ($value) must be of type string, int given, called in Packages/Neos/Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Repository/NodeFactory.php on line 290
A classic one thanks due to phps type casting for numeric array keys :)
$array['123'] will be stored as int
123and not accessible via"123"Additionally the SubtreeTags - pained by a similar bug - are now restricted to be never fully numeric. See discussion in Slack: https://neos-project.slack.com/archives/C04PYL8H3/p1767965980113829
Upgrade instructions
Review instructions
Checklist
FEATURE|TASK|BUGFIX!!!and have upgrade-instructions