@@ -1147,7 +1147,7 @@ private function parse_next_tag() {
11471147 * Abort if no tag is found before the end of
11481148 * the document. There is nothing left to parse.
11491149 */
1150- if ( $ at + 1 >= strlen ( $ html ) ) {
1150+ if ( $ at + 1 >= $ doc_length ) {
11511151 return false ;
11521152 }
11531153
@@ -1161,13 +1161,13 @@ private function parse_next_tag() {
11611161 * https://html.spec.whatwg.org/multipage/parsing.html#tag-open-state
11621162 */
11631163 if (
1164- strlen ( $ html ) > $ at + 3 &&
1164+ $ doc_length > $ at + 3 &&
11651165 '- ' === $ html [ $ at + 2 ] &&
11661166 '- ' === $ html [ $ at + 3 ]
11671167 ) {
11681168 $ closer_at = $ at + 4 ;
11691169 // If it's not possible to close the comment then there is nothing more to scan.
1170- if ( strlen ( $ html ) <= $ closer_at ) {
1170+ if ( $ doc_length <= $ closer_at ) {
11711171 return false ;
11721172 }
11731173
@@ -1185,18 +1185,18 @@ private function parse_next_tag() {
11851185 * See https://html.spec.whatwg.org/#parse-error-incorrectly-closed-comment
11861186 */
11871187 --$ closer_at ; // Pre-increment inside condition below reduces risk of accidental infinite looping.
1188- while ( ++$ closer_at < strlen ( $ html ) ) {
1188+ while ( ++$ closer_at < $ doc_length ) {
11891189 $ closer_at = strpos ( $ html , '-- ' , $ closer_at );
11901190 if ( false === $ closer_at ) {
11911191 return false ;
11921192 }
11931193
1194- if ( $ closer_at + 2 < strlen ( $ html ) && '> ' === $ html [ $ closer_at + 2 ] ) {
1194+ if ( $ closer_at + 2 < $ doc_length && '> ' === $ html [ $ closer_at + 2 ] ) {
11951195 $ at = $ closer_at + 3 ;
11961196 continue 2 ;
11971197 }
11981198
1199- if ( $ closer_at + 3 < strlen ( $ html ) && '! ' === $ html [ $ closer_at + 2 ] && '> ' === $ html [ $ closer_at + 3 ] ) {
1199+ if ( $ closer_at + 3 < $ doc_length && '! ' === $ html [ $ closer_at + 2 ] && '> ' === $ html [ $ closer_at + 3 ] ) {
12001200 $ at = $ closer_at + 4 ;
12011201 continue 2 ;
12021202 }
@@ -1209,7 +1209,7 @@ private function parse_next_tag() {
12091209 * https://html.spec.whatwg.org/multipage/parsing.html#tag-open-state
12101210 */
12111211 if (
1212- strlen ( $ html ) > $ at + 8 &&
1212+ $ doc_length > $ at + 8 &&
12131213 '[ ' === $ html [ $ at + 2 ] &&
12141214 'C ' === $ html [ $ at + 3 ] &&
12151215 'D ' === $ html [ $ at + 4 ] &&
@@ -1233,7 +1233,7 @@ private function parse_next_tag() {
12331233 * https://html.spec.whatwg.org/multipage/parsing.html#tag-open-state
12341234 */
12351235 if (
1236- strlen ( $ html ) > $ at + 8 &&
1236+ $ doc_length > $ at + 8 &&
12371237 ( 'D ' === $ html [ $ at + 2 ] || 'd ' === $ html [ $ at + 2 ] ) &&
12381238 ( 'O ' === $ html [ $ at + 3 ] || 'o ' === $ html [ $ at + 3 ] ) &&
12391239 ( 'C ' === $ html [ $ at + 4 ] || 'c ' === $ html [ $ at + 4 ] ) &&
0 commit comments