Skip to content

Commit 58cb0e4

Browse files
committed
Add some mixed parameter types and fix UNKNOWN default values in ext/xmlrpc
1 parent 01e86d6 commit 58cb0e4

File tree

3 files changed

+10
-14
lines changed

3 files changed

+10
-14
lines changed

ext/xmlrpc/xmlrpc-epi-php.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -966,12 +966,8 @@ PHP_FUNCTION(xmlrpc_server_call_method)
966966
if (zend_parse_parameters(argc, "Osz|a", &handle, xmlrpc_server_ce, &rawxml, &rawxml_len, &caller_params, &output_opts) != SUCCESS) {
967967
RETURN_THROWS();
968968
}
969-
/* user output options */
970-
if (argc == 3) {
971-
set_output_options(&out, NULL);
972-
} else {
973-
set_output_options(&out, output_opts);
974-
}
969+
970+
set_output_options(&out, output_opts ? output_opts : NULL);
975971

976972
server = Z_XMLRPC_SERVER_P(handle);
977973

ext/xmlrpc/xmlrpc.stub.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ final class XmlRpcServer
66
{
77
}
88

9-
function xmlrpc_encode($value): ?string {}
9+
function xmlrpc_encode(mixed $value): ?string {}
1010

1111
function xmlrpc_decode(string $xml, string $encoding = "iso-8859-1"): mixed {}
1212

1313
function xmlrpc_decode_request(string $xml, &$method, string $encoding = "iso-8859-1"): mixed {}
1414

15-
function xmlrpc_encode_request(?string $method, $params, array $output_options = UNKNOWN): ?string {}
15+
function xmlrpc_encode_request(?string $method, mixed $params, array $output_options = []): ?string {}
1616

1717
function xmlrpc_get_type(mixed $value): string {}
1818

@@ -26,7 +26,7 @@ function xmlrpc_server_destroy(XmlRpcServer $server): bool {}
2626

2727
function xmlrpc_server_register_method(XmlRpcServer $server, string $method_name, $function): bool {}
2828

29-
function xmlrpc_server_call_method(XmlRpcServer $server, string $xml, $user_data, array $output_options = UNKNOWN): mixed {}
29+
function xmlrpc_server_call_method(XmlRpcServer $server, string $xml, mixed $user_data, array $output_options = []): mixed {}
3030

3131
function xmlrpc_parse_method_descriptions(string $xml): mixed {}
3232

ext/xmlrpc/xmlrpc_arginfo.h

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

33
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlrpc_encode, 0, 1, IS_STRING, 1)
4-
ZEND_ARG_INFO(0, value)
4+
ZEND_ARG_TYPE_INFO(0, value, IS_MIXED, 0)
55
ZEND_END_ARG_INFO()
66

77
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlrpc_decode, 0, 1, IS_MIXED, 0)
@@ -17,8 +17,8 @@ ZEND_END_ARG_INFO()
1717

1818
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlrpc_encode_request, 0, 2, IS_STRING, 1)
1919
ZEND_ARG_TYPE_INFO(0, method, IS_STRING, 1)
20-
ZEND_ARG_INFO(0, params)
21-
ZEND_ARG_TYPE_INFO(0, output_options, IS_ARRAY, 0)
20+
ZEND_ARG_TYPE_INFO(0, params, IS_MIXED, 0)
21+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, output_options, IS_ARRAY, 0, "[]")
2222
ZEND_END_ARG_INFO()
2323

2424
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlrpc_get_type, 0, 1, IS_STRING, 0)
@@ -50,8 +50,8 @@ ZEND_END_ARG_INFO()
5050
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlrpc_server_call_method, 0, 3, IS_MIXED, 0)
5151
ZEND_ARG_OBJ_INFO(0, server, XmlRpcServer, 0)
5252
ZEND_ARG_TYPE_INFO(0, xml, IS_STRING, 0)
53-
ZEND_ARG_INFO(0, user_data)
54-
ZEND_ARG_TYPE_INFO(0, output_options, IS_ARRAY, 0)
53+
ZEND_ARG_TYPE_INFO(0, user_data, IS_MIXED, 0)
54+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, output_options, IS_ARRAY, 0, "[]")
5555
ZEND_END_ARG_INFO()
5656

5757
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlrpc_parse_method_descriptions, 0, 1, IS_MIXED, 0)

0 commit comments

Comments
 (0)