From:             [EMAIL PROTECTED]
Operating system: Any
PHP version:      5.3CVS-2008-04-23 (CVS)
PHP Bug Type:     SOAP related
Bug description:  [Patch] Improve error message when creating new SoapClient 
with invalid data

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


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

Reply via email to