Skip to content

Commit 32d128d

Browse files
committed
Make SoapVar arguments nullable
$typeName, $typeNamespace, $nodeName and $nodeNamespace all special-case the empty string and don't set the property entirely in that case. It makes more sense to use null to indicate absence here (though of course the empty string behavior is retained).
1 parent 45fa759 commit 32d128d

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

ext/soap/soap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,7 @@ PHP_METHOD(SoapVar, __construct)
693693
char *stype = NULL, *ns = NULL, *name = NULL, *namens = NULL;
694694
size_t stype_len = 0, ns_len = 0, name_len = 0, namens_len = 0;
695695

696-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z!l!|ssss", &data, &type, &type_is_null, &stype, &stype_len, &ns, &ns_len, &name, &name_len, &namens, &namens_len) == FAILURE) {
696+
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z!l!|s!s!s!s!", &data, &type, &type_is_null, &stype, &stype_len, &ns, &ns_len, &name, &name_len, &namens, &namens_len) == FAILURE) {
697697
RETURN_THROWS();
698698
}
699699

ext/soap/soap.stub.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function __toString(): string {}
2525

2626
class SoapVar
2727
{
28-
public function __construct(mixed $data, ?int $encoding, string $typeName = "", string $typeNamespace = "", string $nodeName = "", string $nodeNamespace = "") {}
28+
public function __construct(mixed $data, ?int $encoding, ?string $typeName = null, ?string $typeNamespace = null, ?string $nodeName = null, ?string $nodeNamespace = null) {}
2929
}
3030

3131
class SoapServer

ext/soap/soap_arginfo.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 4f958b1c954386207619cfaefa02c96e90cc0da7 */
2+
* Stub hash: b22d29a51c17d627763229aac15718702002daec */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_use_soap_error_handler, 0, 0, _IS_BOOL, 0)
55
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, enable, _IS_BOOL, 0, "true")
@@ -37,10 +37,10 @@ ZEND_END_ARG_INFO()
3737
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SoapVar___construct, 0, 0, 2)
3838
ZEND_ARG_TYPE_INFO(0, data, IS_MIXED, 0)
3939
ZEND_ARG_TYPE_INFO(0, encoding, IS_LONG, 1)
40-
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, typeName, IS_STRING, 0, "\"\"")
41-
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, typeNamespace, IS_STRING, 0, "\"\"")
42-
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, nodeName, IS_STRING, 0, "\"\"")
43-
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, nodeNamespace, IS_STRING, 0, "\"\"")
40+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, typeName, IS_STRING, 1, "null")
41+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, typeNamespace, IS_STRING, 1, "null")
42+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, nodeName, IS_STRING, 1, "null")
43+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, nodeNamespace, IS_STRING, 1, "null")
4444
ZEND_END_ARG_INFO()
4545

4646
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SoapServer___construct, 0, 0, 1)

0 commit comments

Comments
 (0)