diff --git a/NEWS b/NEWS index baf838481682..19da88d0dd3c 100644 --- a/NEWS +++ b/NEWS @@ -187,6 +187,8 @@ PHP NEWS . Fix namespace handling of WSDL and XML schema in SOAP, fixing at least GH-16320 and bug #68576. (nielsdos) . Fixed bug #70951 (Segmentation fault on invalid WSDL cache). (nielsdos) + . Implement request #55503 (Extend __getTypes to support enumerations). + (nielsdos, datibbaw) - Sockets: . Added IPPROTO_ICMP/IPPROTO_ICMPV6 to create raw socket for ICMP usage. diff --git a/UPGRADING b/UPGRADING index 46284f16ce3f..254c07e09c88 100644 --- a/UPGRADING +++ b/UPGRADING @@ -194,6 +194,9 @@ PHP 8.5 UPGRADE NOTES IntlListFormatter::WIDTH_NARROW widths. It is supported from icu 67. +- SOAP: + . Enumeration cases are now dumped in __getTypes(). + - XSL: . The $namespace argument of XSLTProcessor::getParameter(), XSLTProcessor::setParameter() and XSLTProcessor::removeParameter() diff --git a/ext/soap/soap.c b/ext/soap/soap.c index 094730b88f41..e0577ac648ca 100644 --- a/ext/soap/soap.c +++ b/ext/soap/soap.c @@ -4404,6 +4404,22 @@ static void type_to_string(sdlTypePtr type, smart_str *buf, int level) /* {{{ */ smart_str_appendl(buf, "anyType ", sizeof("anyType ")-1); } smart_str_appendl(buf, type->name, strlen(type->name)); + + if (type->restrictions && type->restrictions->enumeration) { + zend_string *key; + bool first = true; + + smart_str_appends(buf, " {"); + ZEND_HASH_MAP_FOREACH_STR_KEY(type->restrictions->enumeration, key) { + if (first) { + first = false; + } else { + smart_str_appends(buf, ", "); + } + smart_str_append(buf, key); + } ZEND_HASH_FOREACH_END(); + smart_str_appendc(buf, '}'); + } break; case XSD_TYPEKIND_LIST: smart_str_appendl(buf, "list ", 5); diff --git a/ext/soap/tests/bugs/bug42359.phpt b/ext/soap/tests/bugs/bug42359.phpt index 0cb4f75c69be..f717561e7cae 100644 --- a/ext/soap/tests/bugs/bug42359.phpt +++ b/ext/soap/tests/bugs/bug42359.phpt @@ -13,7 +13,7 @@ print_r($soap->__getTypes()); Array ( [0] => list listItem {anonymous1} - [1] => string anonymous1 - [2] => string enumItem + [1] => string anonymous1 {test1, test2} + [2] => string enumItem {test1, test2} [3] => list listItem2 {enumItem} ) diff --git a/ext/soap/tests/req55503.phpt b/ext/soap/tests/req55503.phpt new file mode 100644 index 000000000000..ac3c8627048c --- /dev/null +++ b/ext/soap/tests/req55503.phpt @@ -0,0 +1,16 @@ +--TEST-- +Request #55503 (Extend __getTypes to support enumerations) +--EXTENSIONS-- +soap +--INI-- +soap.wsdl_cache_enabled=0 +--FILE-- +__getTypes()); +?> +--EXPECT-- +array(1) { + [0]=> + string(102) "anyType PersonaMemberType {NEW, LIMITED, FREE, PAID_ACTIVE, TRIAL_ACTIVE, PAID_EXPIRED, TRIAL_EXPIRED}" +} diff --git a/ext/soap/tests/req55503.wsdl b/ext/soap/tests/req55503.wsdl new file mode 100644 index 000000000000..91ac62c8bc00 --- /dev/null +++ b/ext/soap/tests/req55503.wsdl @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + +