|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #52726 getCode() from SoapFault thrown from call to AWS 3.0 returns HTTP not 410 4
Submitted: 2010-08-28 22:53 UTC Modified: -
From: zippy1981 at gmail dot com Assigned:
Status: Open Package: SOAP related
PHP Version: 5.3.3 OS: All
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: zippy1981 at gmail dot com
New email:
PHP Version: OS:


 [2010-08-28 22:53 UTC] zippy1981 at gmail dot com
Exception::getCode() should return an int as per the documentation. Therefore 
SoapFault::getCode() should return the http code.

If you make a soap call to the deprecated Amazon Web Service 3.0 wsdl, a html 410 
(Gone) error is returned. SoapFault::getCode() and SoapFault::faultcode should 
both be 410, but they are HTTP.

Test script:
$client = new SoapClient('', array('trace' => true));
$request = array(
        'keyword' => 'Stuff',
        'page' => '1',
        'mode' => 'books',
        'tag' => 'you\'re it',
        'type' => 'medium',
        'devtag' => 'YOUR-TOKEN-HERE'
try {
catch (SoapFault $ex) {
        if ($ex->faultstring != 'Gone') throw $ex;
        if ($ex->getCode() != '410') {
                echo "UnexpectedCode: " . $ex->getCode();
                throw $ex;

Expected result:

Actual result:
UnexpectedCode: 0PHP Fatal error:  Uncaught SoapFault exception: [HTTP] Gone in 
Stack trace:
#0 [internal function]: SoapClient->__doRequest('<?xml version="...', 
'http://soap.ama...', 'http://soap.ama...', 1, 0)
#1 [internal function]: SoapClient->__call('KeywordSearchRe...', Array)
#2 /home/zippy/src/testfest/ext/soap/tests/client_error001.phpt(20): SoapClient-
#3 {main}
  thrown in /home/zippy/src/testfest/ext/soap/tests/client_error001.phpt on line 


Add a Patch

Pull Requests

Add a Pull Request

PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sat Apr 01 06:03:38 2023 UTC