|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2008-04-23 19:23 UTC] mfischer@php.net
Description:
------------
In case a new SoapClient is created and the loaded XML has problems, the exact libxml2 error message is hidden.
It should be noted that with the provided patch, an extra \n gets introduces which is from the libxml error context "message" member. However I favor more exact error messages over formatting.
Index: php_sdl.c
===================================================================
RCS file: /repository/php-src/ext/soap/php_sdl.c,v
retrieving revision 1.88.2.12.2.9.2.2
diff -u -r1.88.2.12.2.9.2.2 php_sdl.c
--- php_sdl.c 31 Dec 2007 07:17:13 -0000 1.88.2.12.2.9.2.2
+++ php_sdl.c 23 Apr 2008 19:10:01 -0000
@@ -240,7 +240,12 @@
wsdl = soap_xmlParseFile(struri TSRMLS_CC);
if (!wsdl) {
- soap_error1(E_ERROR, "Parsing WSDL: Couldn't load from '%s'", struri);
+ xmlErrorPtr xmlErrorPtr = xmlGetLastError();
+ if (xmlErrorPtr) {
+ soap_error2(E_ERROR, "Parsing WSDL: Couldn't load from '%s': %s", struri, xmlErrorPtr->message);
+ } else {
+ soap_error1(E_ERROR, "Parsing WSDL: Couldn't load from '%s'", struri);
+ }
}
zend_hash_add(&ctx->docs, struri, strlen(struri)+1, (void**)&wsdl, sizeof(xmlDocPtr), NULL);
Reproduce code:
---------------
php -r 'new SoapClient("http://slashdot.org");'
Expected result:
----------------
Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://slashdot.org': Premature end of data in tag html line 3
in Command line code:1
Actual result:
--------------
Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://slashdot.org' in Command line code:1
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 09:00:01 2025 UTC |
Actually one thing you could do is simply this: try { new SoapClient("http://slashdot.org"); } catch(Exception $e) { var_dump(libxml_get_last_error()); } If you store this into a variable, you'll be able to retrieve the ->message property which has the detailed message. We are still evaluating the need of adding the detailed message natively.