|
34 | 34 | * @TODO: Track specific error states, expose informative messages, line |
35 | 35 | * numbers, indexes, and other debugging info. |
36 | 36 | * |
37 | | - * |
38 | 37 | * @TODO: Support XML 1.1. |
39 | 38 | * |
40 | 39 | * @TODO: Evaluate the performance of utf8_codepoint_at() against using the mbstring |
@@ -1934,33 +1933,33 @@ private function parse_next_tag() { |
1934 | 1933 | $quoted_string_length - 2 |
1935 | 1934 | ); |
1936 | 1935 | $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; |
1951 | 1936 | } |
1952 | 1937 |
|
1953 | | - // Skip whitespace following the internal subset. |
| 1938 | + // Skip whitespace. |
1954 | 1939 | $at += strspn( $this->xml, " \t\f\r\n", $at ); |
1955 | 1940 |
|
1956 | 1941 | if ( $doc_length <= $at ) { |
1957 | 1942 | $this->mark_incomplete_input( 'Unclosed DOCTYPE declaration.' ); |
1958 | 1943 |
|
1959 | 1944 | return false; |
1960 | 1945 | } |
1961 | | - } |
1962 | 1946 |
|
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 ] ) { |
1964 | 1963 | $this->bail( |
1965 | 1964 | sprintf( |
1966 | 1965 | 'Syntax error in DOCTYPE declaration. Unexpected character "%s" at position %d.', |
@@ -2638,7 +2637,7 @@ private function skip_conditional_section_body( &$offset, $section_type ) { |
2638 | 2637 | * @return bool Whether the declaration was fully consumed. |
2639 | 2638 | */ |
2640 | 2639 | private function skip_markup_declaration( &$offset ) { |
2641 | | - $doc_length = strlen( $this->xml ); |
| 2640 | + $doc_length = strlen( $this->xml ); |
2642 | 2641 | $keyword_length = $this->parse_name( $offset ); |
2643 | 2642 |
|
2644 | 2643 | if ( 0 === $keyword_length ) { |
|
0 commit comments