php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43462 SOAPClient does not report an error if server returns an empty document
Submitted: 2007-11-30 10:57 UTC Modified: 2009-05-06 01:00 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: andrew at is dot co dot za Assigned:
Status: No Feedback Package: SOAP related
PHP Version: 5.2.5 OS: Fedora Core release 6
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: andrew at is dot co dot za
New email:
PHP Version: OS:

 

 [2007-11-30 10:57 UTC] andrew at is dot co dot za
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.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-04-28 18:34 UTC] jani@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2009-05-06 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2009-06-23 15:16 UTC] andy at webtatic dot com
This is still an issue in PHP 5.2.10, please reopen.

Without throwing a Soap exception, you can't trust a call to have worked correctly.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Oct 07 04:01:27 2024 UTC