Changeset 63913 for trunk/src/wp-includes/class-wp-block-processor.php
- Timestamp:
- 09/24/2026 05:53:51 AM (4 days ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-block-processor.php
r63911 r63913 980 980 * even though it allows for matching invalid JSON content. 981 981 * 982 * The delimiter must also be a single complete HTML comment. 983 * 982 984 * <!-- /wp:core/paragraph {"dropCap":true} /-⃨-⃨>⃨ 983 985 */ 984 $comment_closing_at = strpos( $text, '-->', $json_at ); 985 if ( false === $comment_closing_at ) { 986 $after_comment_end = $this->find_html_comment_end( $comment_opening_at, $end ); 987 988 /* 989 * The reported end of the comment could be after the end of the document if 990 * no actual end was found, so differentiate a comment ending at the end of 991 * the document from documents with missing comment ends. 992 */ 993 if ( $after_comment_end >= $end && ! str_ends_with( $text, '-->' ) && ! str_ends_with( $text, '--!>' ) ) { 986 994 goto incomplete; 987 995 } 996 997 /* 998 * Only normative comment closers are recognized block delimiters, 999 * so skip past any HTML comments ending in `--!>`. 1000 */ 1001 if ( '!' === $text[ $after_comment_end - 2 ] ) { 1002 $at = $after_comment_end; 1003 continue; 1004 } 1005 1006 $comment_closing_at = $after_comment_end - 3; 988 1007 989 1008 // <!-- /wp:core/paragraph {"dropCap":true} /⃨--> … … 1008 1027 } 1009 1028 1010 $at = $ this->find_html_comment_end( $comment_opening_at, $end );1029 $at = $after_comment_end; 1011 1030 continue; 1012 1031 } … … 1016 1035 * 1017 1036 * @todo It’s likely faster to scan forward instead of in reverse. 1037 * @todo Skip ahead with `strcspn()` and decide only on syntax characters. 1018 1038 * 1019 1039 * <!-- /wp:core/paragraph {"dropCap":true}⃨ ⃨/--> … … 1037 1057 1038 1058 default: 1039 ++$at;1059 $at = $after_comment_end; 1040 1060 continue 3; 1041 1061 } … … 1047 1067 */ 1048 1068 if ( 0 === $json_length || 0 === $after_json_whitespace_length ) { 1049 $at = $ this->find_html_comment_end( $comment_opening_at, $end );1069 $at = $after_comment_end; 1050 1070 continue; 1051 1071 } … … 1058 1078 // The end of the document was reached without a match. 1059 1079 if ( self::MATCHED !== $this->state ) { 1080 // Stop at top-level free-form HTML at the end of the document. 1081 if ( $after_prev_delimiter < $end ) { 1082 $this->state = self::HTML_SPAN; 1083 $this->after_previous_delimiter = $after_prev_delimiter; 1084 $this->matched_delimiter_at = $end; 1085 $this->matched_delimiter_length = 0; 1086 $this->open_blocks_at[] = $after_prev_delimiter; 1087 $this->open_blocks_length[] = 0; 1088 $this->was_void = true; 1089 1090 return true; 1091 } 1092 1060 1093 $this->state = self::COMPLETE; 1061 1094 return false; … … 1337 1370 '>' === $text[ $comment_starting_at + 2 + $span_of_dashes ] 1338 1371 ) { 1339 return $comment_starting_at + $span_of_dashes + 1;1372 return $comment_starting_at + 2 + $span_of_dashes + 1; 1340 1373 } 1341 1374
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)