Woops didn't CC the list
---------- Forwarded message ---------- From: nick loeve <[EMAIL PROTECTED]> Date: Nov 23, 2007 4:21 PM Subject: Re: [PHP-DEV] Bug 42773 - WSDL error causes HTTP 500 Response To: Lukas Kahwe Smith <[EMAIL PROTECTED]> On Nov 19, 2007 4:45 PM, Lukas Kahwe Smith <[EMAIL PROTECTED]> wrote: > > On 19.11.2007, at 16:26, nick loeve wrote: > > > On Nov 19, 2007 4:21 PM, Alexey Zakhlestin <[EMAIL PROTECTED]> wrote: > >> imho, exceptions are preferrable in a lot of php's functions… > >> but core php programmers are usually against exceptions if it is not > >> an error of object-constructor > >> > > > > Well in this case the constructor to the SoapClient class specifically > > allows you to say you would like to use exceptions for SoapFaults. Is > > this not a SoapFault... ? > > well its not a soap fault .. since that is something that the service > should throw. the wsdl reading error occurs before you even talk to > the soap service. that being said, i do agree that this should not be > a fatal error. fopen() type hacks prevent the use of the wsdl cache > and are inefficient for obvious reasons. If i attempt to load a WSDL that does not exist I get two fatal errors! One is a fatal error saying that i cannot load the WSDL, and the other is that there is an uncaught exception (with the faultString saying i cannot load the WSDL): --------------------------------------------------------------------------------------------------------------------------------- [EMAIL PROTECTED] ~/src/php_cvs/php5/ext/soap $ php -r '$client = new SoapClient("thisdoesnotexist");' PHP Warning: SoapClient::SoapClient(): I/O warning : failed to load external entity "thisdoesnotexist" in Command line code on line 1 Warning: SoapClient::SoapClient(): I/O warning : failed to load external entity "thisdoesnotexist" in Command line code on line 1 PHP Fatal error: SOAP-ERROR: Parsing WSDL: Couldn't load from 'thisdoesnotexist' in Command line code on line 1 PHP Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'thisdoesnotexist' in Command line code:1 Stack trace: #0 Command line code(1): SoapClient->SoapClient('thisdoesnotexis...') #1 {main} thrown in Command line code on line 1 Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'thisdoesnotexist' in Command line code:1 Stack trace: #0 Command line code(1): SoapClient->SoapClient('thisdoesnotexis...') #1 {main} thrown in Command line code on line 1 --------------------------------------------------------------------------------------------------------------------------------- If i then proceed to wrap the constructor in a try/catch then i can catch the exception but i still get a fatal error: --------------------------------------------------------------------------------------------------------------------------------- [EMAIL PROTECTED] ~/src/php_cvs/php5/ext/soap $ php -r 'try { $client = new SoapClient("asdasdasd");} catch(Exception $e){ echo "caught exception"; }' PHP Warning: SoapClient::SoapClient(): I/O warning : failed to load external entity "asdasdasd" in Command line code on line 1 Warning: SoapClient::SoapClient(): I/O warning : failed to load external entity "asdasdasd" in Command line code on line 1 PHP Fatal error: SOAP-ERROR: Parsing WSDL: Couldn't load from 'asdasdasd' in Command line code on line 1 --------------------------------------------------------------------------------------------------------------------------------- Does anyone else find this strange behavior? Or am I just missing something simple? I also looked at http://bugs.php.net/bug.php?id=34657 and I see that it is marked nothing to fix in the SOAP extension, yet in php_sdl.c 240 wsdl = soap_xmlParseFile(struri TSRMLS_CC); 241 242 if (!wsdl) { 243 soap_error1(E_ERROR, "Parsing WSDL: Couldn't load from '%s'", struri); 244 } Which is triggering a fatal error. Should i make a new bug, request that one of the previous ones is re-opened or is this behaviour never going to change? I do not mind attempting to come up with a patch, but it seems that quite a lot of operations in the SOAP ext just fatal out also. Cheers > > regards, > Lukas -- Nick Loeve www.trickie.org -- Nick Loeve www.trickie.org