]> granicus.if.org Git - php/commitdiff
Fixed bug #29844 (SOAP doesn't return the result of a valid SOAP request).
authorDmitry Stogov <dmitry@php.net>
Thu, 26 Aug 2004 12:20:13 +0000 (12:20 +0000)
committerDmitry Stogov <dmitry@php.net>
Thu, 26 Aug 2004 12:20:13 +0000 (12:20 +0000)
Fixed bug #29830 (SoapServer::setClass() should not export non-public methods).

NEWS
ext/soap/php_packet_soap.c
ext/soap/soap.c
ext/soap/tests/bugs/bug29830.phpt [new file with mode: 0644]
ext/soap/tests/bugs/bug29844.phpt [new file with mode: 0644]
ext/soap/tests/bugs/bug29844.wsdl [new file with mode: 0644]

diff --git a/NEWS b/NEWS
index bc23d8a9f037961fa97c1e7c6327e12616543e2f..2fe020f7d0d92715125bca4517e313b1e5488889 100644 (file)
--- 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)
index b78fdee888bf4266a8d065f5132f7c8986e4a88f..e9cdd47dbc725c2e662da475ffa27f115476af3d 100644 (file)
@@ -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 = ? */
index 45947e1375d7df65d8df611db9d9e0bd0eec9cf7..8224846f9954dbbfc65339414a7e63a479d121b1 100644 (file)
@@ -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 (file)
index 0000000..dc090f8
--- /dev/null
@@ -0,0 +1,25 @@
+--TEST--
+Bug #29844 (SoapServer::setClass() should not export non-public methods)
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+
+class hello_world {   
+  public function hello($to) {
+    return 'Hello ' . $to;
+  }    
+  private function bye($to) {
+    return 'Bye ' . $to;
+  }    
+}
+
+$server = new SoapServer(NULL, array("uri"=>"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 (file)
index 0000000..baf7cde
--- /dev/null
@@ -0,0 +1,36 @@
+--TEST--
+Bug #29844 (SOAP doesn't return the result of a valid SOAP request)
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+
+class hello_world {   
+  public function hello($to) {
+    return 'Hello ' . $to;
+  }    
+}
+
+class LocalSoapClient extends SoapClient {
+
+  function LocalSoapClient($wsdl, $options) {
+    $this->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 (file)
index 0000000..b45aa36
--- /dev/null
@@ -0,0 +1,66 @@
+<?xml version="1.0" ?>\r
+<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://davey.synapticmedia.net/php-mag/shafikdavey_automaticwebservices/src/Listing%201.php" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" name="Crtx_SOAP_AutoDiscover_Example" targetNamespace="http://davey.synapticmedia.net/php-mag/shafikdavey_automaticwebservices/src/Listing%201.php">\r
+  <portType name="Crtx_SOAP_AutoDiscover_ExamplePort">\r
+    <operation name="hello">\r
+      <input message="tns:helloRequest" />\r
+      <output message="tns:helloResponse" />\r
+      <documentation>Say Hello to Somebody</documentation>\r
+    </operation>\r
+    <operation name="goodBye">\r
+      <input message="tns:goodByeRequest" />\r
+      <output message="tns:goodByeResponse" />\r
+      <documentation>Say Goodbye to Somebody</documentation>\r
+    </operation>\r
+  </portType>\r
+  <binding name="Crtx_SOAP_AutoDiscover_ExampleBinding"\r
+  type="tns:Crtx_SOAP_AutoDiscover_ExamplePort">\r
+    <soap:binding style="document"\r
+    transport="http://schemas.xmlsoap.org/soap/http" />\r
+    <operation name="hello">\r
+      <input>\r
+        <soap:body use="encoded"\r
+        encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />\r
+      </input>\r
+      <output>\r
+        <soap:body use="encoded"\r
+        encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />\r
+      </output>\r
+      <soap:operation soapAction="http://davey.synapticmedia.net/php-mag/shafikdavey_automaticwebservices/src/Listing%201.php#hello" />\r
+    </operation>\r
+    <soap:binding style="document"\r
+    transport="http://schemas.xmlsoap.org/soap/http" />\r
+    <operation name="goodBye">\r
+      <input>\r
+        <soap:body use="encoded"\r
+        encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />\r
+      </input>\r
+      <output>\r
+        <soap:body use="encoded"\r
+        encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />\r
+      </output>\r
+      <soap:operation soapAction="http://davey.synapticmedia.net/php-mag/shafikdavey_automaticwebservices/src/Listing%201.php#goodBye" />\r
+    </operation>\r
+  </binding>\r
+  <service name="Crtx_SOAP_AutoDiscover_ExampleService">\r
+    <port name="tns:Crtx_SOAP_AutoDiscover_ExamplePort"\r
+    binding="tns:Crtx_SOAP_AutoDiscover_ExampleBinding">\r
+      <soap:address location="http://davey.synapticmedia.net/php-mag/shafikdavey_automaticwebservices/src/Listing%201.php" />\r
+    </port>\r
+  </service>\r
+  <message name="helloRequest">\r
+    <part name="to" type="xsd:string" />\r
+    <documentation>Say Hello to Somebody</documentation>\r
+  </message>\r
+  <message name="helloResponse">\r
+    <part name="helloReturn" type="xsd:string" />\r
+    <documentation>The greeting</documentation>\r
+  </message>\r
+  <message name="goodByeRequest">\r
+    <part name="to" type="xsd:string" />\r
+    <documentation>Say Goodbye to Somebody</documentation>\r
+  </message>\r
+  <message name="goodByeResponse">\r
+    <part name="goodByeReturn" type="xsd:string" />\r
+    <documentation>The goodbye</documentation>\r
+  </message>\r
+</definitions>\r