diff options
| author | Nikita Popov <nikita.ppv@gmail.com> | 2019-01-04 12:40:28 +0100 |
|---|---|---|
| committer | Nikita Popov <nikita.ppv@gmail.com> | 2019-01-04 12:40:28 +0100 |
| commit | 361d3ede9394d03defba64237628e6b1a0a2a16b (patch) | |
| tree | 4711cce399928ded1a460fe1039b5bb44c5d4a88 | |
| parent | 1ed20669c5be6b9883596249cf4c1d503e6b7d9e (diff) | |
| download | php-git-361d3ede9394d03defba64237628e6b1a0a2a16b.tar.gz | |
Fix bug #77410
| -rw-r--r-- | NEWS | 4 | ||||
| -rw-r--r-- | ext/soap/php_encoding.c | 4 | ||||
| -rw-r--r-- | ext/soap/tests/bug77410.phpt | 25 | ||||
| -rw-r--r-- | ext/soap/tests/bug77410.wsdl | 61 |
4 files changed, 92 insertions, 2 deletions
@@ -35,6 +35,10 @@ PHP NEWS . Fixed bug #77273 (array_walk_recursive corrupts value types leading to PDO failure). (Nikita) +- SOAP: + . Fixed bug #77410 (Segmentation Fault when executing method with an empty + parameter). (Nikita) + - Sockets: . Fixed bug #76839 (socket_recvfrom may return an invalid 'from' address on MacOS). (Michael Meyer) diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c index cd7ea06649..87e13161c7 100644 --- a/ext/soap/php_encoding.c +++ b/ext/soap/php_encoding.c @@ -1856,9 +1856,9 @@ static xmlNodePtr to_xml_object(encodeTypePtr type, zval *data, int style, xmlNo sdlType->encode->details.sdl_type->kind != XSD_TYPEKIND_LIST && sdlType->encode->details.sdl_type->kind != XSD_TYPEKIND_UNION) { - if (prop) {GC_PROTECT_RECURSION(prop);} + if (prop) { GC_TRY_PROTECT_RECURSION(prop); } xmlParam = master_to_xml(sdlType->encode, data, style, parent); - if (prop) {GC_UNPROTECT_RECURSION(prop);} + if (prop) { GC_TRY_UNPROTECT_RECURSION(prop); } } else { zval rv; zval *tmp = get_zval_property(data, "_", &rv); diff --git a/ext/soap/tests/bug77410.phpt b/ext/soap/tests/bug77410.phpt new file mode 100644 index 0000000000..2b74102523 --- /dev/null +++ b/ext/soap/tests/bug77410.phpt @@ -0,0 +1,25 @@ +--TEST-- +Bug #77410: Segmentation Fault when executing method with an empty parameter +--SKIPIF-- +<?php require_once('skipif.inc'); ?> +--FILE-- +<?php + +$client = new class(__DIR__ . '/bug77410.wsdl', [ + 'cache_wsdl' => WSDL_CACHE_NONE, + 'trace' => 1, +]) extends SoapClient { + public function __doRequest($request, $location, $action, $version, $one_way = 0) { + echo $request, "\n"; + return ''; + } +}; + +$client->MyMethod([ + 'parameter' => [], +]); + +?> +--EXPECT-- +<?xml version="1.0" encoding="UTF-8"?> +<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:test"><SOAP-ENV:Body><ns1:MyMethodRequest><parameter/></ns1:MyMethodRequest></SOAP-ENV:Body></SOAP-ENV:Envelope> diff --git a/ext/soap/tests/bug77410.wsdl b/ext/soap/tests/bug77410.wsdl new file mode 100644 index 0000000000..fb976485d6 --- /dev/null +++ b/ext/soap/tests/bug77410.wsdl @@ -0,0 +1,61 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<definitions targetNamespace="urn:test" + xmlns="http://schemas.xmlsoap.org/wsdl/" + xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" + xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" + xmlns:test="urn:test" + xmlns:xsd="http://www.w3.org/2001/XMLSchema"> + + <portType name="TestPortType"> + <operation name="MyMethod"> + <input message="test:MyMethodRequestMessage" /> + <output message="test:MyMethodResponseMessage" /> + </operation> + </portType> + + <binding name="TestBinding" type="test:TestPortType"> + <operation name="MyMethod"> + <input><soap:body use="literal" /></input> + <output><soap:body use="literal" /></output> + </operation> + </binding> + + <message name="MyMethodRequestMessage"> + <part name="parameters" element="test:MyMethodRequest" /> + </message> + + <message name="MyMethodResponseMessage"> + <part name="parameters" element="test:MyMethodResponse" /> + </message> + + <types> + <schema targetNamespace="urn:test" xmlns="http://www.w3.org/2001/XMLSchema"> + + <element name="MyMethodRequest"> + <complexType> + <sequence> + <element name="parameter" type="test:MyMethodRequestObject" /> + </sequence> + </complexType> + </element> + + <element name="MyMethodResponse" /> + + <complexType name="MyMethodRequestObject"> + <complexContent> + <extension base="test:DynamicData" /> + </complexContent> + </complexType> + + <complexType name="DynamicData" /> + + </schema> + </types> + + <service name="TestService"> + <port binding="test:TestBinding" name="TestPort"> + <soap:address location="http://localhost:8080/test-service" /> + </port> + </service> + +</definitions> |
