Skip to content

Commit 4f32443

Browse files
committed
Merge branch 'PHP-8.4'
* PHP-8.4: Revert "Port XML_GetCurrentByteIndex to public APIs"
2 parents 7831f65 + 40894bc commit 4f32443

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

ext/xml/compat.c

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -689,20 +689,8 @@ XML_GetCurrentColumnNumber(XML_Parser parser)
689689
PHP_XML_API long
690690
XML_GetCurrentByteIndex(XML_Parser parser)
691691
{
692-
/* We have to temporarily disable the encoder to satisfy the note from the manual:
693-
* "This function returns byte index according to UTF-8 encoded text disregarding if input is in another encoding."
694-
* Although that should probably be corrected at one point? (TODO) */
695-
xmlCharEncodingHandlerPtr encoder = NULL;
696-
xmlParserInputPtr input = parser->parser->input;
697-
if (input->buf) {
698-
encoder = input->buf->encoder;
699-
input->buf->encoder = NULL;
700-
}
701-
long result = xmlByteConsumed(parser->parser);
702-
if (encoder) {
703-
input->buf->encoder = encoder;
704-
}
705-
return result;
692+
return parser->parser->input->consumed +
693+
(parser->parser->input->cur - parser->parser->input->base);
706694
}
707695

708696
PHP_XML_API int

0 commit comments

Comments
 (0)