HTML API: Preserve decoded carriage returns in serialization#42
HTML API: Preserve decoded carriage returns in serialization#42sirreal wants to merge 3 commits into
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Code reviewFound 1 issue:
wordpress-develop/src/wp-includes/html-api/class-wp-html-processor.php Lines 1513 to 1521 in 7a34cea wordpress-develop/src/wp-includes/html-api/class-wp-html-tag-processor.php Lines 2833 to 2846 in 7a34cea Also verified (no action needed): 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
…ation # Conflicts: # src/wp-includes/html-api/class-wp-html-processor.php
What changed
add_class(). after existing HTML escaping. values.Why
A decoded carriage-return character reference such as
was serialized as a literal CR byte. Re-parsing normalized output applies HTML input-stream preprocessing, which turns raw CR into LF, soWP_HTML_Processor::normalize()was not byte-idempotent.A follow-up review found the inverse risk for raw attribute CR/CRLF: raw source newlines must normalize to LF before character-reference decoding, otherwise they can be incorrectly preserved as
.Validation
WP_TESTS_SKIP_INSTALL=1 ./vendor/bin/phpunit --group html-api,html-api-html5lib-tests./vendor/bin/phpcs src/wp-includes/html-api/class-wp-html-processor.php src/wp-includes/html-api/class-wp-html-tag-processor.php tests/phpunit/tests/html-api/wpHtmlProcessor-serialize.phpcodex review --base e1f1f5873a0d7c10d4e3d137184d7fb974525c9c023771e2f7b2against this branch: normalize output is byte-idempotent, contains no literal CR, and contains .