|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull Requests |
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 10:00:01 2025 UTC |
Description: ------------ 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: --------------- <?php $client = new SoapClient('http://soap.amazon.com/schemas2/AmazonWebServices.wsdl', array('trace' => true)); $request = array( 'keyword' => 'Stuff', 'page' => '1', 'mode' => 'books', 'tag' => 'you\'re it', 'type' => 'medium', 'devtag' => 'YOUR-TOKEN-HERE' ); try { $client->KeywordSearchRequest($request); } catch (SoapFault $ex) { if ($ex->faultstring != 'Gone') throw $ex; if ($ex->getCode() != '410') { echo "UnexpectedCode: " . $ex->getCode(); throw $ex; } } Expected result: ---------------- Nothing Actual result: -------------- UnexpectedCode: 0PHP Fatal error: Uncaught SoapFault exception: [HTTP] Gone in /home/zippy/src/testfest/ext/soap/tests/client_error001.phpt:20 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- >KeywordSearchRequest(Array) #3 {main} thrown in /home/zippy/src/testfest/ext/soap/tests/client_error001.phpt on line 20