@@ -881,22 +881,6 @@ PHP_METHOD(XMLReader, next)
881
881
}
882
882
/* }}} */
883
883
884
- static bool xmlreader_valid_encoding (const char * encoding )
885
- {
886
- if (!encoding ) {
887
- return true;
888
- }
889
-
890
- /* Normally we could use xmlTextReaderConstEncoding() afterwards but libxml2 < 2.12.0 has a bug of course
891
- * where it returns NULL for some valid encodings instead. */
892
- xmlCharEncodingHandlerPtr handler = xmlFindCharEncodingHandler (encoding );
893
- if (!handler ) {
894
- return false;
895
- }
896
- xmlCharEncCloseFunc (handler );
897
- return true;
898
- }
899
-
900
884
/* {{{ Sets the URI that the XMLReader will parse. */
901
885
static void xml_reader_from_uri (INTERNAL_FUNCTION_PARAMETERS , zend_class_entry * instance_ce , bool use_exceptions )
902
886
{
@@ -925,7 +909,7 @@ static void xml_reader_from_uri(INTERNAL_FUNCTION_PARAMETERS, zend_class_entry *
925
909
RETURN_THROWS ();
926
910
}
927
911
928
- if (!xmlreader_valid_encoding (encoding )) {
912
+ if (!php_libxml_is_valid_encoding (encoding )) {
929
913
zend_argument_value_error (2 , "must be a valid character encoding" );
930
914
RETURN_THROWS ();
931
915
}
@@ -1013,7 +997,7 @@ PHP_METHOD(XMLReader, fromStream)
1013
997
1014
998
php_stream_from_res (stream , Z_RES_P (stream_zv ));
1015
999
1016
- if (!xmlreader_valid_encoding (encoding_name )) {
1000
+ if (!php_libxml_is_valid_encoding (encoding_name )) {
1017
1001
zend_argument_value_error (2 , "must be a valid character encoding" );
1018
1002
RETURN_THROWS ();
1019
1003
}
@@ -1197,7 +1181,7 @@ static void xml_reader_from_string(INTERNAL_FUNCTION_PARAMETERS, zend_class_entr
1197
1181
RETURN_THROWS ();
1198
1182
}
1199
1183
1200
- if (!xmlreader_valid_encoding (encoding )) {
1184
+ if (!php_libxml_is_valid_encoding (encoding )) {
1201
1185
zend_argument_value_error (2 , "must be a valid character encoding" );
1202
1186
RETURN_THROWS ();
1203
1187
}
0 commit comments