Fix crash when tag body contains URL-encoded characters#4086
Merged
jaapio merged 2 commits intoApr 10, 2026
Conversation
When a tag is invalid (e.g. @see with a non-FQSEN reference), the InvalidTagAssembler creates a Description directly from the raw body. If the body contains URL-encoded sequences like %20, vsprintf interprets them as format specifiers and throws a ValueError. Escape % to %% in InvalidTagAssembler, AuthorAssembler, and ExampleAssembler to match DescriptionFactory's existing behavior. Fixes phpDocumentor#3891
Assert on the rendered description string rather than the internal body template, so the test actually exercises the vsprintf call that was crashing before the fix.
jaapio
approved these changes
Apr 10, 2026
Member
|
Thanks again, small pr's are easy to review. 👍 Please note that the invalid tag is only created because the format of the tag was incorrect. I don't know exactly what it should be. I can try to find that when you are able to change the source. |
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
When a tag is invalid (e.g.
@seewith a non-FQSEN reference likeLDAP-Error-Code), theInvalidTagAssemblercreates aDescriptiondirectly from the raw tag body. If the body contains URL-encoded sequences like%20,vsprintfinterprets them as format specifiers and throws aValueError.DescriptionFactory::create()already escapes%to%%for this exact reason (line 81), but the assemblers that bypass the factory and callnew Description(...)directly were missing the same escaping.This escapes
%to%%inInvalidTagAssembler,AuthorAssembler, andExampleAssembler.How to reproduce
Generates:
Fixes #3891