Skip to content

Commit f1dbb92

Browse files
committed
Fix UNKNOWN default values in ext/xml
1 parent ffb3b12 commit f1dbb92

File tree

6 files changed

+11
-11
lines changed

6 files changed

+11
-11
lines changed

ext/xml/xml.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,7 +1012,7 @@ static void php_xml_parser_create_impl(INTERNAL_FUNCTION_PARAMETERS, int ns_supp
10121012

10131013
XML_Char *encoding;
10141014

1015-
if (zend_parse_parameters(ZEND_NUM_ARGS(), (ns_support ? "|ss": "|s"), &encoding_param, &encoding_param_len, &ns_param, &ns_param_len) == FAILURE) {
1015+
if (zend_parse_parameters(ZEND_NUM_ARGS(), (ns_support ? "|s!s": "|s"), &encoding_param, &encoding_param_len, &ns_param, &ns_param_len) == FAILURE) {
10161016
RETURN_THROWS();
10171017
}
10181018

@@ -1289,7 +1289,7 @@ PHP_FUNCTION(xml_parse_into_struct)
12891289
size_t data_len;
12901290
int ret;
12911291

1292-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Osz|z", &pind, xml_parser_ce, &data, &data_len, &xdata, &info) == FAILURE) {
1292+
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Osz|z!", &pind, xml_parser_ce, &data, &data_len, &xdata, &info) == FAILURE) {
12931293
RETURN_THROWS();
12941294
}
12951295

ext/xml/xml.stub.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
/** @generate-function-entries */
44

5-
function xml_parser_create(string $encoding = UNKNOWN): XmlParser|false {}
5+
function xml_parser_create(?string $encoding = null): XmlParser|false {}
66

7-
function xml_parser_create_ns(string $encoding = UNKNOWN, string $sep = ':'): XmlParser|false {}
7+
function xml_parser_create_ns(?string $encoding = null, string $sep = ':'): XmlParser|false {}
88

99
function xml_set_object(XmlParser $parser, object $obj): bool {}
1010

@@ -40,7 +40,7 @@ function xml_set_end_namespace_decl_handler(XmlParser $parser, $hdl): bool {}
4040

4141
function xml_parse(XmlParser $parser, string $data, bool $isfinal = false): int {}
4242

43-
function xml_parse_into_struct(XmlParser $parser, string $data, &$values, &$index = UNKNOWN): int {}
43+
function xml_parse_into_struct(XmlParser $parser, string $data, &$values, &$index = null): int {}
4444

4545
function xml_get_error_code(XmlParser $parser): int {}
4646

ext/xml/xml_arginfo.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/* This is a generated file, edit the .stub.php file instead. */
22

33
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_xml_parser_create, 0, 0, XmlParser, MAY_BE_FALSE)
4-
ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
4+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, encoding, IS_STRING, 1, "null")
55
ZEND_END_ARG_INFO()
66

77
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_xml_parser_create_ns, 0, 0, XmlParser, MAY_BE_FALSE)
8-
ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
8+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, encoding, IS_STRING, 1, "null")
99
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, sep, IS_STRING, 0, "\':\'")
1010
ZEND_END_ARG_INFO()
1111

@@ -49,7 +49,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xml_parse_into_struct, 0, 3, IS_
4949
ZEND_ARG_OBJ_INFO(0, parser, XmlParser, 0)
5050
ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
5151
ZEND_ARG_INFO(1, values)
52-
ZEND_ARG_INFO(1, index)
52+
ZEND_ARG_INFO_WITH_DEFAULT_VALUE(1, index, "null")
5353
ZEND_END_ARG_INFO()
5454

5555
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xml_get_error_code, 0, 1, IS_LONG, 0)

ext/xmlreader/php_xmlreader.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,7 @@ PHP_METHOD(XMLReader, next)
811811
xmlreader_object *intern;
812812
char *name = NULL;
813813

814-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s", &name, &name_len) == FAILURE) {
814+
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s!", &name, &name_len) == FAILURE) {
815815
RETURN_THROWS();
816816
}
817817

ext/xmlreader/php_xmlreader.stub.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function moveToNextAttribute() {}
4747
public function read() {}
4848

4949
/** @return bool */
50-
public function next(string $localname = UNKNOWN) {}
50+
public function next(?string $localname = null) {}
5151

5252
/** @return bool|XMLReader */
5353
public static function open(string $URI, ?string $encoding = null, int $options = 0) {}

ext/xmlreader/php_xmlreader_arginfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ ZEND_END_ARG_INFO()
4141
#define arginfo_class_XMLReader_read arginfo_class_XMLReader_close
4242

4343
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLReader_next, 0, 0, 0)
44-
ZEND_ARG_TYPE_INFO(0, localname, IS_STRING, 0)
44+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, localname, IS_STRING, 1, "null")
4545
ZEND_END_ARG_INFO()
4646

4747
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLReader_open, 0, 0, 1)

0 commit comments

Comments
 (0)