Skip to content

Commit 6d8aae1

Browse files
nielsdosdatibbaw
andcommitted
Implement request #55503: Extend __getTypes to support enumerations
I ported the patch to 8.5. Co-authored-by: datibbaw <[email protected]>
1 parent 5d2f0cb commit 6d8aae1

File tree

4 files changed

+23
-2
lines changed

4 files changed

+23
-2
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,8 @@ PHP NEWS
186186
header is correct). (nielsdos)
187187
. Fix namespace handling of WSDL and XML schema in SOAP,
188188
fixing at least GH-16320 and bug #68576. (nielsdos)
189+
. Implement request #55503 (Extend __getTypes to support enumerations).
190+
(nielsdos, datibbaw)
189191

190192
- Sockets:
191193
. Added IPPROTO_ICMP/IPPROTO_ICMPV6 to create raw socket for ICMP usage.

UPGRADING

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,9 @@ PHP 8.5 UPGRADE NOTES
194194
IntlListFormatter::WIDTH_NARROW widths.
195195
It is supported from icu 67.
196196

197+
- SOAP:
198+
. Enumeration cases are now dumped in __getTypes().
199+
197200
- XSL:
198201
. The $namespace argument of XSLTProcessor::getParameter(),
199202
XSLTProcessor::setParameter() and XSLTProcessor::removeParameter()

ext/soap/soap.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4405,6 +4405,22 @@ static void type_to_string(sdlTypePtr type, smart_str *buf, int level) /* {{{ */
44054405
smart_str_appendl(buf, "anyType ", sizeof("anyType ")-1);
44064406
}
44074407
smart_str_appendl(buf, type->name, strlen(type->name));
4408+
4409+
if (type->restrictions && type->restrictions->enumeration) {
4410+
zend_string *key;
4411+
bool first = true;
4412+
4413+
smart_str_appends(buf, " {");
4414+
ZEND_HASH_MAP_FOREACH_STR_KEY(type->restrictions->enumeration, key) {
4415+
if (first) {
4416+
first = false;
4417+
} else {
4418+
smart_str_appends(buf, ", ");
4419+
}
4420+
smart_str_append(buf, key);
4421+
} ZEND_HASH_FOREACH_END();
4422+
smart_str_appendc(buf, '}');
4423+
}
44084424
break;
44094425
case XSD_TYPEKIND_LIST:
44104426
smart_str_appendl(buf, "list ", 5);

ext/soap/tests/bugs/bug42359.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ print_r($soap->__getTypes());
1313
Array
1414
(
1515
[0] => list listItem {anonymous1}
16-
[1] => string anonymous1
17-
[2] => string enumItem
16+
[1] => string anonymous1 {test1, test2}
17+
[2] => string enumItem {test1, test2}
1818
[3] => list listItem2 {enumItem}
1919
)

0 commit comments

Comments
 (0)