Changeset 57506
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/html-api/class-wp-html-tag-processor.php
r57489 r57506 1763 1763 'A' === $html[ $this->token_starts_at + 7 ] && 1764 1764 '[' === $html[ $this->token_starts_at + 8 ] && 1765 ']' === $html[ $closer_at - 1 ] 1765 ']' === $html[ $closer_at - 1 ] && 1766 ']' === $html[ $closer_at - 2 ] 1766 1767 ) { 1767 1768 $this->parser_state = self::STATE_COMMENT; -
trunk/tests/phpunit/tests/html-api/wpHtmlTagProcessor-token-scanning.php
r57348 r57506 349 349 350 350 /** 351 * Ensures that normative CDATA sections are properly parsed. 352 * 353 * @ticket 60406 354 * 355 * @since 6.5.0 356 * 357 * @covers WP_HTML_Tag_Processor::next_token 358 */ 359 public function test_cdata_comment_with_incorrect_closer() { 360 $processor = new WP_HTML_Tag_Processor( '<![CDATA[this is missing a closing square bracket]>' ); 361 $processor->next_token(); 362 363 $this->assertSame( 364 '#comment', 365 $processor->get_token_name(), 366 "Should have found comment token but found {$processor->get_token_name()} instead." 367 ); 368 369 $this->assertSame( 370 WP_HTML_Processor::COMMENT_AS_INVALID_HTML, 371 $processor->get_comment_type(), 372 'Should have detected invalid HTML comment.' 373 ); 374 375 $this->assertSame( 376 '[CDATA[this is missing a closing square bracket]', 377 $processor->get_modifiable_text(), 378 'Found incorrect modifiable text.' 379 ); 380 } 381 382 /** 351 383 * Ensures that abruptly-closed CDATA sections are properly parsed as comments. 352 384 * … … 365 397 $processor->get_token_name(), 366 398 "Should have found a bogus comment but found {$processor->get_token_name()} instead." 399 ); 400 401 $this->assertSame( 402 WP_HTML_Processor::COMMENT_AS_INVALID_HTML, 403 $processor->get_comment_type(), 404 'Should have detected invalid HTML comment.' 367 405 ); 368 406
Note: See TracChangeset
for help on using the changeset viewer.