From 48dba110e2a9e88d8df6054a2674845de773547c Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Thu, 26 Aug 2004 12:20:13 +0000 Subject: [PATCH] Fixed bug #29844 (SOAP doesn't return the result of a valid SOAP request). Fixed bug #29830 (SoapServer::setClass() should not export non-public methods). --- NEWS | 4 ++ ext/soap/php_packet_soap.c | 8 +++- ext/soap/soap.c | 4 +- ext/soap/tests/bugs/bug29830.phpt | 25 ++++++++++++ ext/soap/tests/bugs/bug29844.phpt | 36 +++++++++++++++++ ext/soap/tests/bugs/bug29844.wsdl | 66 +++++++++++++++++++++++++++++++ 6 files changed, 140 insertions(+), 3 deletions(-) create mode 100644 ext/soap/tests/bugs/bug29830.phpt create mode 100644 ext/soap/tests/bugs/bug29844.phpt create mode 100644 ext/soap/tests/bugs/bug29844.wsdl diff --git a/NEWS b/NEWS index bc23d8a9f0..2fe020f7d0 100644 --- a/NEWS +++ b/NEWS @@ -9,6 +9,10 @@ PHP NEWS (Paul Hudson, Derick) - Fixed bug with raw_post_data not getting set (Brian) - Fixed a file-descriptor leak with phpinfo() and other 'special' URLs (Zeev) +- Fixed bug #29844 (SOAP doesn't return the result of a valid SOAP request). + (Dmitry) +- Fixed bug #29830 (SoapServer::setClass() should not export non-public + methods). (Dmitry) - Fixed bug #29821 (Fixed possible crashes in convert_uudecode() on invalid data). (Ilia) - Fixed bug #29808 (array_count_values() breaks with numeric strings). (Ilia) diff --git a/ext/soap/php_packet_soap.c b/ext/soap/php_packet_soap.c index b78fdee888..e9cdd47dbc 100644 --- a/ext/soap/php_packet_soap.c +++ b/ext/soap/php_packet_soap.c @@ -250,8 +250,12 @@ int parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunction while (zend_hash_get_current_data(fn->responseParameters, (void **)&h_param) == SUCCESS) { param = (*h_param); if (fnb->style == SOAP_DOCUMENT) { - name = param->encode->details.type_str; - ns = param->encode->details.ns; + if (param->element) { + name = param->encode->details.type_str; + ns = param->encode->details.ns; + } else { + name = param->paramName; + } } else { name = fn->responseName; /* ns = ? */ diff --git a/ext/soap/soap.c b/ext/soap/soap.c index 45947e1375..8224846f99 100644 --- a/ext/soap/soap.c +++ b/ext/soap/soap.c @@ -1126,7 +1126,9 @@ PHP_METHOD(SoapServer, getFunctions) HashPosition pos; zend_hash_internal_pointer_reset_ex(ft, &pos); while (zend_hash_get_current_data_ex(ft, (void **)&f, &pos) != FAILURE) { - add_next_index_string(return_value, f->common.function_name, 1); + if ((service->type != SOAP_CLASS) || (f->common.fn_flags & ZEND_ACC_PUBLIC)) { + add_next_index_string(return_value, f->common.function_name, 1); + } zend_hash_move_forward_ex(ft, &pos); } } diff --git a/ext/soap/tests/bugs/bug29830.phpt b/ext/soap/tests/bugs/bug29830.phpt new file mode 100644 index 0000000000..dc090f82cc --- /dev/null +++ b/ext/soap/tests/bugs/bug29830.phpt @@ -0,0 +1,25 @@ +--TEST-- +Bug #29844 (SoapServer::setClass() should not export non-public methods) +--SKIPIF-- + +--FILE-- +"test://")); +$server->setClass('hello_world'); +$functions = $server->getFunctions(); +foreach($functions as $func) { + echo $func . "\n"; +} +?> +--EXPECT-- +hello diff --git a/ext/soap/tests/bugs/bug29844.phpt b/ext/soap/tests/bugs/bug29844.phpt new file mode 100644 index 0000000000..baf7cde6d3 --- /dev/null +++ b/ext/soap/tests/bugs/bug29844.phpt @@ -0,0 +1,36 @@ +--TEST-- +Bug #29844 (SOAP doesn't return the result of a valid SOAP request) +--SKIPIF-- + +--FILE-- +SoapClient($wsdl, $options); + $this->server = new SoapServer($wsdl, $options); + $this->server->setClass('hello_world');; + } + + function __doRequest($request, $location, $action, $version) { + ob_start(); + $this->server->handle($request); + $response = ob_get_contents(); + ob_end_clean(); + return $response; + } + +} + +$client = new LocalSoapClient(dirname(__FILE__)."/bug29844.wsdl", array("trace"=>1)); +var_dump($client->hello('davey')); +?> +--EXPECT-- +string(11) "Hello davey" diff --git a/ext/soap/tests/bugs/bug29844.wsdl b/ext/soap/tests/bugs/bug29844.wsdl new file mode 100644 index 0000000000..b45aa3666f --- /dev/null +++ b/ext/soap/tests/bugs/bug29844.wsdl @@ -0,0 +1,66 @@ + + + + + + + Say Hello to Somebody + + + + + Say Goodbye to Somebody + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Say Hello to Somebody + + + + The greeting + + + + Say Goodbye to Somebody + + + + The goodbye + + -- 2.50.1