Skip to content

Commit 17a23c0

Browse files
committed
phpcbf
1 parent 49d9527 commit 17a23c0

File tree

1 file changed

+18
-19
lines changed

1 file changed

+18
-19
lines changed

components/XML/class-xmlprocessor.php

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
* @TODO: Track specific error states, expose informative messages, line
3535
* numbers, indexes, and other debugging info.
3636
*
37-
*
3837
* @TODO: Support XML 1.1.
3938
*
4039
* @TODO: Evaluate the performance of utf8_codepoint_at() against using the mbstring
@@ -1934,33 +1933,33 @@ private function parse_next_tag() {
19341933
$quoted_string_length - 2
19351934
);
19361935
$at += $quoted_string_length;
1937-
}
1938-
1939-
// Skip whitespace.
1940-
$at += strspn( $this->xml, " \t\f\r\n", $at );
1941-
1942-
if ( $doc_length <= $at ) {
1943-
$this->mark_incomplete_input( 'Unclosed DOCTYPE declaration.' );
1944-
1945-
return false;
1946-
}
1947-
1948-
if ( '[' === $this->xml[ $at ] ) {
1949-
if ( ! $this->skip_doctype_internal_subset( $at ) ) {
1950-
return false;
19511936
}
19521937

1953-
// Skip whitespace following the internal subset.
1938+
// Skip whitespace.
19541939
$at += strspn( $this->xml, " \t\f\r\n", $at );
19551940

19561941
if ( $doc_length <= $at ) {
19571942
$this->mark_incomplete_input( 'Unclosed DOCTYPE declaration.' );
19581943

19591944
return false;
19601945
}
1961-
}
19621946

1963-
if ( '>' !== $this->xml[ $at ] ) {
1947+
if ( '[' === $this->xml[ $at ] ) {
1948+
if ( ! $this->skip_doctype_internal_subset( $at ) ) {
1949+
return false;
1950+
}
1951+
1952+
// Skip whitespace following the internal subset.
1953+
$at += strspn( $this->xml, " \t\f\r\n", $at );
1954+
1955+
if ( $doc_length <= $at ) {
1956+
$this->mark_incomplete_input( 'Unclosed DOCTYPE declaration.' );
1957+
1958+
return false;
1959+
}
1960+
}
1961+
1962+
if ( '>' !== $this->xml[ $at ] ) {
19641963
$this->bail(
19651964
sprintf(
19661965
'Syntax error in DOCTYPE declaration. Unexpected character "%s" at position %d.',
@@ -2638,7 +2637,7 @@ private function skip_conditional_section_body( &$offset, $section_type ) {
26382637
* @return bool Whether the declaration was fully consumed.
26392638
*/
26402639
private function skip_markup_declaration( &$offset ) {
2641-
$doc_length = strlen( $this->xml );
2640+
$doc_length = strlen( $this->xml );
26422641
$keyword_length = $this->parse_name( $offset );
26432642

26442643
if ( 0 === $keyword_length ) {

0 commit comments

Comments
 (0)