summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXinchen Hui <laruence@gmail.com>2018-11-21 11:23:47 +0800
committerXinchen Hui <laruence@gmail.com>2018-11-21 11:30:32 +0800
commitaaafd793e6f74aa6afc233d9594d176266ba0684 (patch)
tree3b15e6eeb20a187a2f9f52f4ac5db482853e304c
parentefeb810a3dd409dfb611ca8e6e1e1dd51ae90c92 (diff)
downloadphp-git-aaafd793e6f74aa6afc233d9594d176266ba0684.tar.gz
Fixed bug #77088 (Segfault when using SoapClient with null options)
SoapClient constructor has its own error handler
-rw-r--r--NEWS4
-rw-r--r--ext/soap/soap.c8
-rw-r--r--ext/soap/tests/bug77088.phpt65
3 files changed, 73 insertions, 4 deletions
diff --git a/NEWS b/NEWS
index 330e282814..7c67fa1f55 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,10 @@ PHP NEWS
. Fixed bug #71041 (zend_signal_startup() needs ZEND_API).
(Valentin V. Bartenev)
+- Soap:
+ . Fixed bug #77088 (Segfault when using SoapClient with null options).
+ (Laruence)
+
- Sockets:
. Fixed bug #77136 (Unsupported IPV6_RECVPKTINFO constants on macOS).
(Mizunashi Mana)
diff --git a/ext/soap/soap.c b/ext/soap/soap.c
index 4dcfd9eebd..bff077d95f 100644
--- a/ext/soap/soap.c
+++ b/ext/soap/soap.c
@@ -1117,8 +1117,8 @@ PHP_METHOD(SoapServer, SoapServer)
SOAP_SERVER_BEGIN_CODE();
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "z|a", &wsdl, &options) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|a", &wsdl, &options) == FAILURE) {
+ php_error_docref(NULL, E_ERROR, "Invalid parameters");
}
if (Z_TYPE_P(wsdl) != IS_STRING && Z_TYPE_P(wsdl) != IS_NULL) {
@@ -2273,8 +2273,8 @@ PHP_METHOD(SoapClient, SoapClient)
SOAP_CLIENT_BEGIN_CODE();
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "z|a", &wsdl, &options) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|a", &wsdl, &options) == FAILURE) {
+ php_error_docref(NULL, E_ERROR, "Invalid parameters");
}
if (Z_TYPE_P(wsdl) != IS_STRING && Z_TYPE_P(wsdl) != IS_NULL) {
diff --git a/ext/soap/tests/bug77088.phpt b/ext/soap/tests/bug77088.phpt
new file mode 100644
index 0000000000..0c1a604f2e
--- /dev/null
+++ b/ext/soap/tests/bug77088.phpt
@@ -0,0 +1,65 @@
+--TEST--
+Bug #77088 (Segfault when using SoapClient with null options)
+--SKIPIF--
+<?php
+ require_once('skipif.inc');
+?>
+--FILE--
+<?php
+
+try
+{
+ $options = NULL;
+ $sClient = new SoapClient("test.wsdl", $options);
+}
+catch(SoapFault $e)
+{
+ var_dump($e);
+}
+
+?>
+--EXPECTF--
+Warning: SoapClient::SoapClient() expects parameter 2 to be array, null given in %sbug77088.php on line %d
+object(SoapFault)#%d (%d) {
+ ["message":protected]=>
+ string(44) "SoapClient::SoapClient(): Invalid parameters"
+ ["string":"Exception":private]=>
+ string(0) ""
+ ["code":protected]=>
+ int(0)
+ ["file":protected]=>
+ string(%d) "%sbug77088.php"
+ ["line":protected]=>
+ int(6)
+ ["trace":"Exception":private]=>
+ array(1) {
+ [0]=>
+ array(6) {
+ ["file"]=>
+ string(%d) "%sbug77088.php"
+ ["line"]=>
+ int(6)
+ ["function"]=>
+ string(10) "SoapClient"
+ ["class"]=>
+ string(10) "SoapClient"
+ ["type"]=>
+ string(2) "->"
+ ["args"]=>
+ array(2) {
+ [0]=>
+ string(9) "test.wsdl"
+ [1]=>
+ NULL
+ }
+ }
+ }
+ ["previous":"Exception":private]=>
+ NULL
+ ["faultstring"]=>
+ string(44) "SoapClient::SoapClient(): Invalid parameters"
+ ["faultcode"]=>
+ string(6) "Client"
+ ["faultcodens"]=>
+ string(41) "http://schemas.xmlsoap.org/soap/envelope/"
+}