We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 49a6c81 commit 8cf2527Copy full SHA for 8cf2527
1 file changed
src/wp-includes/html-api/class-wp-html-tag-processor.php
@@ -3865,9 +3865,19 @@ static function ( $matches ) {
3865
$plaintext_content
3866
);
3867
} elseif ( $this->is_json_script_tag() ) {
3868
- /*
+ /**
3869
* JSON can be safely escaped.
3870
+ *
3871
+ * The following replacement may appear insuficcient, "<" is replaced
3872
+ * with its JSON escape sequence "\u003C" without considering whether
3873
+ * the "<" is preceded by an escaping slash. JSON does not support
3874
+ * arbitrary character escaping (like JavaScript strings) so "\<"
3875
+ * is invalid JSON and would have to be preceded by
3876
+ * an escaped backslash: "\\<".
3877
3878
+ * @see https://www.json.org/json-en.html
3879
*/
3880
+
3881
$plaintext_content = strtr(
3882
$plaintext_content,
3883
array( '<' => '\\u003C' )
0 commit comments