Repository navigation
Escape data in the HTML outputs; draw tokens from random_int - #11
Merged
Merged
Conversation
The Table, PrintR and HTML outputs show data as text: keys and values are escaped. PrintR prints the data instead of print_r's return value. TokenGenerator uses random_int; alphabets and lengths are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DqZUi2UiBJP6rZoCSRcdpE
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DqZUi2UiBJP6rZoCSRcdpE
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.
What changes
HTML data outputs.
Outputs\Table,Outputs\PrintRand the data fallback ofOutputs\HTMLshow a data structure in an HTML page. Keys and values are data, so they are now escaped (htmlspecialchars,ENT_QUOTES | ENT_SUBSTITUTE, UTF-8). The table's own markup is unchanged.Also fixed on the way:
TablesentContent-type: text/html, charset=utf-8(comma); it is nowtext/html; charset=utf-8.PrintRconcatenated the return value ofprint_r()without the return flag, so it printed the data outside the<pre>and then a1; it now prints the escaped dump inside a closed<pre>.Tokens.
TokenGenerator::getToken()andgetSimplifiedToken()draw fromrandom_int()instead ofmt_rand(). Same alphabets, same lengths, same signatures.Behaviour change
A value that contained HTML on purpose and was shown through
Table,PrintRor the data fallback ofHTMLnow appears as text. A response body set withsetBody()is left alone.Tests
New
tests/OutputEscapingTest.php. Withphpunit --exclude-group=database(the CI selection) on PHP 8.5 locally: 208 tests, 3 errors, all inMySQLErrorTest, which needs themysqliextension my local PHP lacks and errors the same way onmaster.Release
Intended for 3.3.1.
🤖 Generated with Claude Code
https://claude.ai/code/session_01DqZUi2UiBJP6rZoCSRcdpE