[BUGFIX] Improve error handling for invalid guides.xml configuration#1117
Merged
linawolf merged 4 commits intoTYPO3-Documentation:mainfrom Dec 11, 2025
Merged
Conversation
4 tasks
Member
|
failing tests are unrelated, I need to fix them first |
62d5193 to
add60cc
Compare
Instead of crashing with a PHP Fatal error when guides.xml contains invalid configuration (e.g., using <theme name="..."/> element instead of theme="..." attribute), the guides entrypoint now catches InvalidTypeException and InvalidConfigurationException and displays a helpful error message. The message includes: - The actual configuration error - Common causes of the error - A correct format example - Suggestion to run lint-guides-xml for detailed validation Resolves the confusing "Expected scalar, but got array" fatal error that users encounter with malformed guides.xml files.
7fbd49a to
70862af
Compare
garvinhicking
approved these changes
Dec 11, 2025
Contributor
garvinhicking
left a comment
There was a problem hiding this comment.
I think this looks helpful... not too sure about possible impacts when catching these very specific exceptions, so I'd like some more vote/feedback on this patch, especially due to the AI usage.
linawolf
approved these changes
Dec 11, 2025
Contributor
Author
That's why I also provided a more comprehensive patch with #1118 |
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.
Summary
Instead of crashing with a PHP Fatal error when guides.xml contains invalid configuration, the guides entrypoint now catches
InvalidTypeExceptionandInvalidConfigurationExceptionand displays a helpful error message.Before:
After:
Approach
This is a minimal fix that catches exceptions and provides a user-friendly error message. It's simple (~25 lines) but doesn't provide line numbers or specific validation details.
Alternative
See also the companion PR with a comprehensive fix that validates against XSD schema before loading, providing exact line/column numbers: #1118
Test plan
<theme name="typo3docs" />as child elementbin/guides run --config=Documentation Documentation