[6.x] Fix errors when a structure tree contains a null item#14941
Open
mynetx wants to merge 1 commit into
Open
[6.x] Fix errors when a structure tree contains a null item#14941mynetx wants to merge 1 commit into
mynetx wants to merge 1 commit into
Conversation
A null item in a tree (e.g. a corrupted yaml file) would crash Entry::order() and augmentation via array_flip(), and crash the tree diff when saving. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
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.
When a structure tree somehow ends up with a
nullitem (e.g.[{entry: ...}, null]in the yaml — the reporter isn't sure how it got there), reading an entry'sorder()— including through augmentation — blows up witharray_flip(): Can only flip string and integer values, and saving the tree crashes the diff with an undefined array key error.This removes null items (including nested ones under
children) when the tree is set, so trees hydrated from disk, set programmatically, or saved through the CP are always clean — and the next save writes a healed file.Supersedes #14802, which was closed for targeting 5.x.
Fixes #14801