From:             andrew at is dot co dot za
Operating system: Fedora Core release 6
PHP version:      5.2.5
PHP Bug Type:     SOAP related
Bug description:  SOAPClient does not report an error if server returns an 
empty document

Description:
------------
SOAPClient does not report an error when it issues a request to a server
and that server returns an empty document instead of a valid SOAP
response.

In the client.php script below, setting $break_me=false results in
SOAPClient not reporting an error. Setting $break_me=true results in the
SOAPFault 'looks like we got no XML document'. Both cases should return
this error.

Reproduce code:
---------------
server.php:

<?php
$break_me = false;
if ($break_me)
        echo "Corrupt XML data";
?>

client.php:

<?php
$client = new SoapClient(dirname(__FILE__) . '/soaptest.wsdl',
array('exceptions' => false));
$ret = $client->Test123();
if (is_soap_fault($ret))
        echo "SOAP Fault: " . $ret->faultstring;
else
        echo "Result: '$ret'";
?>

soaptest.wsdl:

<?xml version="1.0"?>
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/";
xmlns:xsd="http://www.w3.org/2001/XMLSchema"; xmlns:tns="urn:soaptest"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/";
targetNamespace="urn:soaptest">
  <types>
    <xsd:schema targetNamespace="urn:soaptest"/>
  </types>
  <message name="Test123Input"/>
  <message name="Test123Output">
    <part name="return" type="xsd:string"/>
  </message>
  <portType name="SOAPTestPortType">
    <operation name="Test123">
      <input message="tns:Test123Input"/>
      <output message="tns:Test123Output"/>
    </operation>
  </portType>
  <binding name="SOAPTestBinding" type="tns:SOAPTestPortType">
    <soap:binding xmlns="http://schemas.xmlsoap.org/wsdl/soap/";
style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
    <operation xmlns:default="http://schemas.xmlsoap.org/wsdl/soap/";
name="Test123">
      <input xmlns:default="http://schemas.xmlsoap.org/wsdl/soap/";>
        <soap:body xmlns="http://schemas.xmlsoap.org/wsdl/soap/";
use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
namespace="urn:soaptest"/>
      </input>
      <output xmlns:default="http://schemas.xmlsoap.org/wsdl/soap/";>
        <soap:body xmlns="http://schemas.xmlsoap.org/wsdl/soap/";
use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
namespace="urn:soaptest"/>
      </output>
    </operation>
  </binding>
  <service name="SOAPTestService">
    <port xmlns:default="http://schemas.xmlsoap.org/wsdl/soap/";
name="SOAPTestPort" binding="tns:SOAPTestBinding">
      <soap:address xmlns="http://schemas.xmlsoap.org/wsdl/soap/";
location="http://localhost/server.php"/>
    </port>
  </service>
</definitions>

Expected result:
----------------
$ret in client.php should be a SOAPFault indicating that the server did
not return an XML document

Actual result:
--------------
$ret == null, resulting in output of "Result: ''"

There is no way do distinguish this null value from a null value
legitimately returned by a function on the SOAP server.

-- 
Edit bug report at http://bugs.php.net/?id=43462&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=43462&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=43462&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): 
http://bugs.php.net/fix.php?id=43462&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=43462&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=43462&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=43462&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=43462&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=43462&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=43462&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=43462&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=43462&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=43462&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=43462&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=43462&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=43462&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=43462&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=43462&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=43462&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=43462&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=43462&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=43462&r=mysqlcfg

Reply via email to