Commit 40894bcc497 for php.net
commit 40894bcc4974625cf3d9e7834d1bf663994202a2
Merge: 94b58239e88 54e662c6f51
Author: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
Date: Wed Apr 23 22:08:10 2025 +0200
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
Revert "Port XML_GetCurrentByteIndex to public APIs"
diff --cc ext/xml/compat.c
index d338c7d17b9,a3283f71f75..cafb19c2c1e
--- a/ext/xml/compat.c
+++ b/ext/xml/compat.c
@@@ -686,23 -706,11 +686,11 @@@ XML_GetCurrentColumnNumber(XML_Parser p
return parser->parser->input->col;
}
-PHP_XML_API int
+PHP_XML_API long
XML_GetCurrentByteIndex(XML_Parser parser)
{
- /* We have to temporarily disable the encoder to satisfy the note from the manual:
- * "This function returns byte index according to UTF-8 encoded text disregarding if input is in another encoding."
- * Although that should probably be corrected at one point? (TODO) */
- xmlCharEncodingHandlerPtr encoder = NULL;
- xmlParserInputPtr input = parser->parser->input;
- if (input->buf) {
- encoder = input->buf->encoder;
- input->buf->encoder = NULL;
- }
- long result = xmlByteConsumed(parser->parser);
- if (encoder) {
- input->buf->encoder = encoder;
- }
- return result;
+ return parser->parser->input->consumed +
+ (parser->parser->input->cur - parser->parser->input->base);
}
PHP_XML_API int