Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.14.0

Bug #7634 E_ERROR and E_WARNING inside SoapObject::$methodname
Submitted: 2006-05-16 00:31 UTC
From: vitaly at yakovenko dot net Assigned:
Status: Open Package: SOAP (version 0.9.4)
PHP Version: 4.4.2 OS: Linux
Roadmaps: (Not assigned)    
Subscription  


 [2006-05-16 00:31 UTC] vitaly at yakovenko dot net (Vitali Yakavenka)
Description: ------------ Hi everybody. I have a problem with error reporting inside an object which generate response for SOAP request. I mean object::method() which called from SOAP_Server::callMethod(). In my current configuration I have log_errors enabled in php.ini. So, all errors is (should be) logged. But any error which appear inside SOAP Object isn't logged by default. Well. If I have E_WARNING than I can see error in SOAP Response, but if there is an E_ERROR, which can't be handled by SOAP_Server::_errorHandler(), that's real problem because I don't see it either in SOAP Response or log file (probably because of error muting @, I'm not sure). So, to solve this problem I've deleted @ before call to SOAP Object method, added ini_set('display_errors', false) to hide all errors and added writing to log file in SOAP_Server::_errorHandler() if option enabled in configuration. Patch file solving this problem to expected result can be downloaded from http://vitaly.yakovenko.net/soap/SOAP_Server.patch . Put it in pear directory and `patch -p0 < SOAP_Server.patch`. Hope this will help. Regards. Vitali. Test script: --------------- <?php // Uncomment line by line to see result function HandleRequest() { //include 'asdf.php'; // 1: should generate E_WARNING //require 'asdf.php'; // 2: should generate E_ERROR //parse error here // 3: should generate E_PARSE } ?> Expected result: ---------------- 1: E_WARNING wrapped in SOAP Response and record in log file. 2: at least something saying that error happened 3: at leat something saying that error happened. Actual result: -------------- 1: E_WARNING wrapped in SOAP Response without record in log file. 2: nothing at all! 3: record in log file

Comments

 [2006-06-19 14:52 UTC] yunosh (Jan Schneider)
Can you please try the following patch and use PEAR's error handler instead, e.g. with PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'your_callback_handler')? http://dev.horde.org/~jan/Server.diff
 [2006-06-19 19:07 UTC] vitali at yakavenka dot net (Vitali Yakavenka)
Hi Jan, I tried your solution. As I see from PEAR_Error and PEAR code, if you set callback method for PEAR it can be called from method PEAR::raiseError(). If you want to call manual handler without using raiseError you have to pass callback method in PEAR_Error constructor. So, for me this solution doesn't works. Thanks for answer anyway.
 [2006-06-20 08:02 UTC] yunosh (Jan Schneider)
I don't understand where you see the problem then. If I understand correctly, you didn't get the errors logged because the error handler returned too early because we silenced the call_user_function() calls. With my patch the PEAR_Error is raised *before* the (soap) error handler returns. If you register a custom error callback with PEAR, this callback should be executed even if the error happens in a silenced function call.
 [2006-06-20 16:24 UTC] vitaly at yakovenko dot net
Well, You understood my problem correctly, but... First of all, as I see there is 2 ways to specify callback fucntion. First - parameter in PEAR_Error constructor, another is PEAR::setErrorHandling(). If you open PEAR_Error constructor, you'll see that if you don't specify $mode parameter in constructor, it's PEAR_ERROR_RETURN by default, and no other callback function will be called. From other side. To call callback function registered with PEAR::setErrorHandling() you have to call PEAR::throwError(). In current code I can't do any of these. I hope this time it's clear what I'm talking about.
 [2006-06-20 17:05 UTC] yunosh (Jan Schneider)
I see, you are right.
 [2014-12-29 17:32 UTC] yunosh (Jan Schneider)
-Status: Assigned +Status: Open