[BUGFIX] Render class info modal from plain-text data attributes#1345
Open
CybotTM wants to merge 1 commit into
Open
[BUGFIX] Render class info modal from plain-text data attributes#1345CybotTM wants to merge 1 commit into
CybotTM wants to merge 1 commit into
Conversation
Member
|
I think transporting the plain text values is much cleaner. Does this work for all kind of supported languages or only for PHP? |
The class information for :php: and :php-short: was assembled as an HTML string in PhpTextRole and shipped through data-details. Since ab24ff7 escapes that attribute in Twig and in the modal JS, the markup reached the user as visible text, and summaries from api.typo3.org, which are already HTML encoded, gained a second layer so " became readable. Pass signature, flags and summary as separate plain-text attributes and let the modal write the markup around them. Every value is escaped exactly once, and no markup crosses the attribute boundary. Decode the API summary on read so plain text is what travels internally. The duplicate FQN line drops out of the details block for :php-short:; data-fqn already carries it and the modal renders it in its own section. The zero-width-space entity around backslashes goes with the HTML blob. Fixes #1344 Signed-off-by: Sebastian Mendel <github@sebastianmendel.de>
CybotTM
force-pushed
the
task/structured-modal-details
branch
from
July 25, 2026 14:03
681584a to
a9b77e3
Compare
Contributor
Author
|
Hi @linawolf ,
works for all. |
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.
Proposal for option a in #1344 — something concrete to compare against the sanitizer route. Merge only if that is the option you want.
What it does
PhpTextRole::getClassCodeNode()no longer assembles HTML. Signature, flags and summary travel as separate plain-textdata-*values, and the modal writes the markup around them:Every value is escaped exactly once, and no markup crosses the attribute boundary — nothing to sanitize, no allowlist to maintain.
The API summary is decoded on read, so plain text is what travels internally:
Rendered result for the example from the issue:
The
"there is Twig escaping one real"for the attribute;element.datasethands the modal a plain quote.Two deliberate behaviour changes
:php-short:loses its second FQN line.data-fqnalready carries the FQN and the modal renders it in its own section.str_replace('\\', '​\\', …)inserted around backslashes goes with the HTML blob. It only ever applied to the details string.Both are visible in the diff and are why this is a proposal rather than something I would merge on my own.
Verification
PHP 8.5.8. One integration fixture changes, the changelog one; the
typo3-filefixture is a non-API role and keeps the escaped plain text from #1343.ModalDetails.test.jscovers what the modal renders, which is the gap #1344 describes: signature and summary become<code>/<em>elements, a quote in the summary stays a quote, plaindata-detailsstill works for roles without API info, and markup arriving in either field stays inert. The XSS regression tests from ab24ff7 pass unchanged.