@@ -171,15 +171,7 @@ class WXREntityReader implements EntityReader {
171171 * @since WP_VERSION
172172 * @var int
173173 */
174- private $ last_xml_byte_offset_outside_of_entity ;
175-
176- /**
177- * The XML processor cursor of the last entity opener.
178- *
179- * @since WP_VERSION
180- * @var string|null
181- */
182- private $ last_xml_cursor_outside_of_entity ;
174+ private $ entity_opener_byte_offset ;
183175
184176 /**
185177 * Whether the current entity has been emitted.
@@ -431,13 +423,13 @@ public function get_reentrancy_cursor() {
431423 */
432424 $ xml_cursor = $ this ->xml ->get_reentrancy_cursor ();
433425 $ xml_cursor = json_decode ( base64_decode ( $ xml_cursor ), true );
434- $ xml_cursor ['upstream_bytes_forgotten ' ] = $ this ->last_xml_byte_offset_outside_of_entity ;
426+ $ xml_cursor ['upstream_bytes_forgotten ' ] = $ this ->entity_opener_byte_offset ;
435427 $ xml_cursor = base64_encode ( json_encode ( $ xml_cursor ) );
436428
437429 return json_encode (
438430 array (
439431 'xml ' => $ xml_cursor ,
440- 'upstream ' => $ this ->last_xml_byte_offset_outside_of_entity ,
432+ 'upstream ' => $ this ->entity_opener_byte_offset ,
441433 'last_post_id ' => $ this ->last_post_id ,
442434 'last_comment_id ' => $ this ->last_comment_id ,
443435 )
@@ -663,8 +655,7 @@ private function read_next_entity() {
663655 }
664656
665657 if ( count ( $ breadcrumbs ) <= 2 && $ this ->xml ->is_tag_opener () ) {
666- $ this ->last_xml_byte_offset_outside_of_entity = $ this ->xml ->get_token_byte_offset_in_the_input_stream ();
667- $ this ->last_xml_cursor_outside_of_entity = $ this ->xml ->get_reentrancy_cursor ();
658+ $ this ->entity_opener_byte_offset = $ this ->xml ->get_token_byte_offset_in_the_input_stream ();
668659 }
669660
670661 $ tag_with_namespace = $ this ->xml ->get_tag_name_with_namespace ();
@@ -697,8 +688,7 @@ private function read_next_entity() {
697688 // the previous entity is finished.
698689 if ( $ this ->xml ->is_tag_opener () ) {
699690 $ this ->set_entity_tag ( $ tag_with_namespace );
700- $ this ->last_xml_byte_offset_outside_of_entity = $ this ->xml ->get_token_byte_offset_in_the_input_stream ();
701- $ this ->last_xml_cursor_outside_of_entity = $ this ->xml ->get_reentrancy_cursor ();
691+ $ this ->entity_opener_byte_offset = $ this ->xml ->get_token_byte_offset_in_the_input_stream ();
702692 }
703693 continue ;
704694 }
@@ -753,8 +743,9 @@ private function read_next_entity() {
753743 $ this ->xml ->matches_breadcrumbs ( array ( 'rss ' , 'channel ' , '* ' ) ) &&
754744 array_key_exists ( $ this ->xml ->get_tag_name_with_namespace (), static ::KNOWN_SITE_OPTIONS )
755745 );
746+
756747 if ( $ is_site_option_opener ) {
757- $ this ->last_xml_byte_offset_outside_of_entity = $ this ->xml ->get_token_byte_offset_in_the_input_stream ();
748+ $ this ->entity_opener_byte_offset = $ this ->xml ->get_token_byte_offset_in_the_input_stream ();
758749 }
759750 continue ;
760751 }
0 commit comments