Skip to content

Commit 760faa1

Browse files
committed
Fixed bug #79357
Peculiarly, for once the cause was not SOAPs "interesting" error handling, but a bug in the call trampoline for internal functions...
1 parent 02beefd commit 760faa1

File tree

5 files changed

+74
-2
lines changed

5 files changed

+74
-2
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ PHP NEWS
33

44
?? ??? ????, PHP 7.4.5
55

6+
- SOAP:
7+
. Fixed bug #79357 (SOAP request segfaults when any request parameter is
8+
missing). (Nikita)
9+
610
- Spl:
711
. Fixed bug #75673 (SplStack::unserialize() behavior). (cmb)
812

Zend/zend_vm_def.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8301,10 +8301,10 @@ ZEND_VM_HANDLER(158, ZEND_CALL_TRAMPOLINE, ANY, ANY)
83018301
}
83028302

83038303
if (ret == NULL) {
8304-
ZVAL_NULL(&retval);
83058304
ret = &retval;
83068305
}
83078306

8307+
ZVAL_NULL(ret);
83088308
if (!zend_execute_internal) {
83098309
/* saves one function call if zend_execute_internal is not used */
83108310
fbc->internal_function.handler(call, ret);

Zend/zend_vm_execute.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2806,10 +2806,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CALL_TRAMPOLINE_SPEC_HANDLER(Z
28062806
}
28072807

28082808
if (ret == NULL) {
2809-
ZVAL_NULL(&retval);
28102809
ret = &retval;
28112810
}
28122811

2812+
ZVAL_NULL(ret);
28132813
if (!zend_execute_internal) {
28142814
/* saves one function call if zend_execute_internal is not used */
28152815
fbc->internal_function.handler(call, ret);

ext/soap/tests/bug79357.phpt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
--TEST--
2+
Bug #79357: SOAP request segfaults when any request parameter is missing
3+
--FILE--
4+
<?php
5+
6+
$sc = new SoapClient(__DIR__ . '/bug79357.wsdl');
7+
$res = $sc->Add(['intA'=>1]);
8+
var_dump($res);
9+
10+
?>
11+
--EXPECTF--
12+
Fatal error: Uncaught SoapFault exception: [Client] SOAP-ERROR: Encoding: object has no 'intB' property in %s:%d
13+
Stack trace:
14+
#0 %s(%d): SoapClient->__call('Add', Array)
15+
#1 {main}
16+
thrown in %s on line %d

ext/soap/tests/bug79357.wsdl

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://tempuri.org/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
3+
<wsdl:types>
4+
<s:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/">
5+
<s:element name="Add">
6+
<s:complexType>
7+
<s:sequence>
8+
<s:element minOccurs="1" maxOccurs="1" name="intA" type="s:int" />
9+
<s:element minOccurs="1" maxOccurs="1" name="intB" type="s:int" />
10+
</s:sequence>
11+
</s:complexType>
12+
</s:element>
13+
<s:element name="AddResponse">
14+
<s:complexType>
15+
<s:sequence>
16+
<s:element minOccurs="1" maxOccurs="1" name="AddResult" type="s:int" />
17+
</s:sequence>
18+
</s:complexType>
19+
</s:element>
20+
</s:schema>
21+
</wsdl:types>
22+
<wsdl:message name="AddSoapIn">
23+
<wsdl:part name="parameters" element="tns:Add" />
24+
</wsdl:message>
25+
<wsdl:message name="AddSoapOut">
26+
<wsdl:part name="parameters" element="tns:AddResponse" />
27+
</wsdl:message>
28+
<wsdl:portType name="CalculatorSoap">
29+
<wsdl:operation name="Add">
30+
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Adds two integers. This is a test WebService. ©DNE Online</wsdl:documentation>
31+
<wsdl:input message="tns:AddSoapIn" />
32+
<wsdl:output message="tns:AddSoapOut" />
33+
</wsdl:operation>
34+
</wsdl:portType>
35+
<wsdl:binding name="CalculatorSoap" type="tns:CalculatorSoap">
36+
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
37+
<wsdl:operation name="Add">
38+
<soap:operation soapAction="http://tempuri.org/Add" style="document" />
39+
<wsdl:input>
40+
<soap:body use="literal" />
41+
</wsdl:input>
42+
<wsdl:output>
43+
<soap:body use="literal" />
44+
</wsdl:output>
45+
</wsdl:operation>
46+
</wsdl:binding>
47+
<wsdl:service name="Calculator">
48+
<wsdl:port name="CalculatorSoap" binding="tns:CalculatorSoap">
49+
<soap:address location="http://www.dneonline.com/calculator.asmx" />
50+
</wsdl:port>
51+
</wsdl:service>
52+
</wsdl:definitions>

0 commit comments

Comments
 (0)