File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed
tests/phpunit/tests/formatting Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -536,6 +536,15 @@ public function data_element_sanity() {
536536 "Hello <![CDATA[ <!-- a \nhttps://youtu.be/jgz0uSaOZbE \n a \n9 ]]> --> " ,
537537 "<p>Hello <![CDATA[ <!-- a \nhttps://youtu.be/jgz0uSaOZbE \n a \n9 ]]> --></p> \n" ,
538538 ),
539+ /*
540+ * CDATA sections do not exist within HTML, so even though it looks
541+ * like this should be escaping the entire “inner comment” span, there’s
542+ * actually an invalid comment starting at `<![CDATA[` and ending at
543+ * the very first `>` character, placing the end of the comment at
544+ * what looks like the end of the “normal comment” — the ` -->`. Everything
545+ * afterward is normal HTML data so the `<br>` is a real `BR` element and
546+ * the `]]>` is normal plaintext, not the CDATA terminator.
547+ */
539548 array (
540549 "Hello <![CDATA[ <!-- a \nhttps://youtu.be/jgz0uSaOZbE \n a \n9 --> a \n9 ]]> " ,
541550 "<p>Hello <![CDATA[ <!-- a \nhttps://youtu.be/jgz0uSaOZbE \n a \n9 --> a<br /> \n9 ]]></p> \n" ,
Original file line number Diff line number Diff line change @@ -30,6 +30,13 @@ public function data_basic_features() {
3030 'abcd <!-- <html> --> efgh ' ,
3131 array ( 'abcd ' , '<!-- <html> --> ' , ' efgh ' ),
3232 ),
33+ /*
34+ * CDATA sections do not exist within HTML, so even though it looks
35+ * like this should be escaping the entire ` <html> ` span, there’s
36+ * actually an invalid comment starting at `<![CDATA[` and ending at
37+ * the very first `>` character, placing the end of the comment at
38+ * the end of `html>`. The rest is normal plaintext content.
39+ */
3340 array (
3441 'abcd <![CDATA[ <html> ]]> efgh ' ,
3542 array ( 'abcd ' , '<![CDATA[ <html> ' , ' ]]> efgh ' ),
You can’t perform that action at this time.
0 commit comments