Skip to content

Rename XmlParser to XMLParser for consistency with XMLWriter/XMLReader #6451

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ext/xml/tests/bug78563.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ clone $parser;
?>
===DONE===
--EXPECTF--
Fatal error: Uncaught Error: Trying to clone an uncloneable object of class XmlParser in %s:%d
Fatal error: Uncaught Error: Trying to clone an uncloneable object of class XMLParser in %s:%d
Stack trace:
#0 {main}
thrown in %s on line %d
2 changes: 1 addition & 1 deletion ext/xml/tests/bug78563_final.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ class Dummy extends Xmlparser {
?>
===DONE===
--EXPECTF--
Fatal error: Class Dummy may not inherit from final class (XmlParser) in %s on line %d
Fatal error: Class Dummy may not inherit from final class (XMLParser) in %s on line %d
4 changes: 2 additions & 2 deletions ext/xml/tests/bug78563_serialize.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ serialize($parser);
?>
===DONE===
--EXPECTF--
Fatal error: Uncaught Exception: Serialization of 'XmlParser' is not allowed in %s:%d
Fatal error: Uncaught Exception: Serialization of 'XMLParser' is not allowed in %s:%d
Stack trace:
#0 %s(%d): serialize(Object(XmlParser))
#0 %s(%d): serialize(Object(XMLParser))
#1 {main}
thrown in %s on line %d
4 changes: 2 additions & 2 deletions ext/xml/xml.c
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ static void php_xml_free_wrapper(void *ptr)
PHP_MINIT_FUNCTION(xml)
{
zend_class_entry ce;
INIT_CLASS_ENTRY(ce, "XmlParser", class_XmlParser_methods);
INIT_CLASS_ENTRY(ce, "XMLParser", class_XMLParser_methods);
xml_parser_ce = zend_register_internal_class(&ce);
xml_parser_ce->create_object = xml_parser_create_object;
xml_parser_ce->ce_flags |= ZEND_ACC_FINAL | ZEND_ACC_NO_DYNAMIC_PROPERTIES;
Expand Down Expand Up @@ -423,7 +423,7 @@ static HashTable *xml_parser_get_gc(zend_object *object, zval **table, int *n)
}

static zend_function *xml_parser_get_constructor(zend_object *object) {
zend_throw_error(NULL, "Cannot directly construct XmlParser, use xml_parser_create() or xml_parser_create_ns() instead");
zend_throw_error(NULL, "Cannot directly construct XMLParser, use xml_parser_create() or xml_parser_create_ns() instead");
return NULL;
}

Expand Down
44 changes: 22 additions & 22 deletions ext/xml/xml.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,67 +2,67 @@

/** @generate-function-entries */

function xml_parser_create(?string $encoding = null): XmlParser {}
function xml_parser_create(?string $encoding = null): XMLParser {}

function xml_parser_create_ns(?string $encoding = null, string $separator = ":"): XmlParser {}
function xml_parser_create_ns(?string $encoding = null, string $separator = ":"): XMLParser {}

function xml_set_object(XmlParser $parser, object $object): bool {}
function xml_set_object(XMLParser $parser, object $object): bool {}

/**
* @param callable $start_handler
* @param callable $end_handler
*/
function xml_set_element_handler(XmlParser $parser, $start_handler, $end_handler): bool {}
function xml_set_element_handler(XMLParser $parser, $start_handler, $end_handler): bool {}

/** @param callable $handler */
function xml_set_character_data_handler(XmlParser $parser, $handler): bool {}
function xml_set_character_data_handler(XMLParser $parser, $handler): bool {}

/** @param callable $handler */
function xml_set_processing_instruction_handler(XmlParser $parser, $handler): bool {}
function xml_set_processing_instruction_handler(XMLParser $parser, $handler): bool {}

/** @param callable $handler */
function xml_set_default_handler(XmlParser $parser, $handler): bool {}
function xml_set_default_handler(XMLParser $parser, $handler): bool {}

/** @param callable $handler */
function xml_set_unparsed_entity_decl_handler(XmlParser $parser, $handler): bool {}
function xml_set_unparsed_entity_decl_handler(XMLParser $parser, $handler): bool {}

/** @param callable $handler */
function xml_set_notation_decl_handler(XmlParser $parser, $handler): bool {}
function xml_set_notation_decl_handler(XMLParser $parser, $handler): bool {}

/** @param callable $handler */
function xml_set_external_entity_ref_handler(XmlParser $parser, $handler): bool {}
function xml_set_external_entity_ref_handler(XMLParser $parser, $handler): bool {}

/** @param callable $handler */
function xml_set_start_namespace_decl_handler(XmlParser $parser, $handler): bool {}
function xml_set_start_namespace_decl_handler(XMLParser $parser, $handler): bool {}

/** @param callable $handler */
function xml_set_end_namespace_decl_handler(XmlParser $parser, $handler): bool {}
function xml_set_end_namespace_decl_handler(XMLParser $parser, $handler): bool {}

function xml_parse(XmlParser $parser, string $data, bool $is_final = false): int {}
function xml_parse(XMLParser $parser, string $data, bool $is_final = false): int {}

/**
* @param array $values
* @param array $index
*/
function xml_parse_into_struct(XmlParser $parser, string $data, &$values, &$index = null): int {}
function xml_parse_into_struct(XMLParser $parser, string $data, &$values, &$index = null): int {}

function xml_get_error_code(XmlParser $parser): int {}
function xml_get_error_code(XMLParser $parser): int {}

function xml_error_string(int $error_code): ?string {}

function xml_get_current_line_number(XmlParser $parser): int {}
function xml_get_current_line_number(XMLParser $parser): int {}

function xml_get_current_column_number(XmlParser $parser): int {}
function xml_get_current_column_number(XMLParser $parser): int {}

function xml_get_current_byte_index(XmlParser $parser): int {}
function xml_get_current_byte_index(XMLParser $parser): int {}

function xml_parser_free(XmlParser $parser): bool {}
function xml_parser_free(XMLParser $parser): bool {}

/** @param string|int $value */
function xml_parser_set_option(XmlParser $parser, int $option, $value): bool {}
function xml_parser_set_option(XMLParser $parser, int $option, $value): bool {}

function xml_parser_get_option(XmlParser $parser, int $option): string|int {}
function xml_parser_get_option(XMLParser $parser, int $option): string|int {}

final class XmlParser
final class XMLParser
{
}
26 changes: 13 additions & 13 deletions ext/xml/xml_arginfo.h
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 7014b171486b2a597f659369a707a592c26b3b2f */
* Stub hash: d42215062c41775bae538cd310bc60e63fa06a8e */

ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_xml_parser_create, 0, 0, XmlParser, 0)
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_xml_parser_create, 0, 0, XMLParser, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, encoding, IS_STRING, 1, "null")
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_xml_parser_create_ns, 0, 0, XmlParser, 0)
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_xml_parser_create_ns, 0, 0, XMLParser, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, encoding, IS_STRING, 1, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, separator, IS_STRING, 0, "\":\"")
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xml_set_object, 0, 2, _IS_BOOL, 0)
ZEND_ARG_OBJ_INFO(0, parser, XmlParser, 0)
ZEND_ARG_OBJ_INFO(0, parser, XMLParser, 0)
ZEND_ARG_TYPE_INFO(0, object, IS_OBJECT, 0)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xml_set_element_handler, 0, 3, _IS_BOOL, 0)
ZEND_ARG_OBJ_INFO(0, parser, XmlParser, 0)
ZEND_ARG_OBJ_INFO(0, parser, XMLParser, 0)
ZEND_ARG_INFO(0, start_handler)
ZEND_ARG_INFO(0, end_handler)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xml_set_character_data_handler, 0, 2, _IS_BOOL, 0)
ZEND_ARG_OBJ_INFO(0, parser, XmlParser, 0)
ZEND_ARG_OBJ_INFO(0, parser, XMLParser, 0)
ZEND_ARG_INFO(0, handler)
ZEND_END_ARG_INFO()

Expand All @@ -41,20 +41,20 @@ ZEND_END_ARG_INFO()
#define arginfo_xml_set_end_namespace_decl_handler arginfo_xml_set_character_data_handler

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xml_parse, 0, 2, IS_LONG, 0)
ZEND_ARG_OBJ_INFO(0, parser, XmlParser, 0)
ZEND_ARG_OBJ_INFO(0, parser, XMLParser, 0)
ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, is_final, _IS_BOOL, 0, "false")
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xml_parse_into_struct, 0, 3, IS_LONG, 0)
ZEND_ARG_OBJ_INFO(0, parser, XmlParser, 0)
ZEND_ARG_OBJ_INFO(0, parser, XMLParser, 0)
ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
ZEND_ARG_INFO(1, values)
ZEND_ARG_INFO_WITH_DEFAULT_VALUE(1, index, "null")
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xml_get_error_code, 0, 1, IS_LONG, 0)
ZEND_ARG_OBJ_INFO(0, parser, XmlParser, 0)
ZEND_ARG_OBJ_INFO(0, parser, XMLParser, 0)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xml_error_string, 0, 1, IS_STRING, 1)
Expand All @@ -68,17 +68,17 @@ ZEND_END_ARG_INFO()
#define arginfo_xml_get_current_byte_index arginfo_xml_get_error_code

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xml_parser_free, 0, 1, _IS_BOOL, 0)
ZEND_ARG_OBJ_INFO(0, parser, XmlParser, 0)
ZEND_ARG_OBJ_INFO(0, parser, XMLParser, 0)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xml_parser_set_option, 0, 3, _IS_BOOL, 0)
ZEND_ARG_OBJ_INFO(0, parser, XmlParser, 0)
ZEND_ARG_OBJ_INFO(0, parser, XMLParser, 0)
ZEND_ARG_TYPE_INFO(0, option, IS_LONG, 0)
ZEND_ARG_INFO(0, value)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_xml_parser_get_option, 0, 2, MAY_BE_STRING|MAY_BE_LONG)
ZEND_ARG_OBJ_INFO(0, parser, XmlParser, 0)
ZEND_ARG_OBJ_INFO(0, parser, XMLParser, 0)
ZEND_ARG_TYPE_INFO(0, option, IS_LONG, 0)
ZEND_END_ARG_INFO()

Expand Down Expand Up @@ -134,6 +134,6 @@ static const zend_function_entry ext_functions[] = {
};


static const zend_function_entry class_XmlParser_methods[] = {
static const zend_function_entry class_XMLParser_methods[] = {
ZEND_FE_END
};