PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Web Services » SOAP » Bug #7634

E_ERROR and E_WARNING inside SoapObject::$methodname

Details

Submitted2006-05-16 00:31 UTC
Fromvitaly at yakovenko dot net
StatusOpen
PackageSOAP
PHP Version4.4.2
OSLinux
Roadmaps(Not assigned)

Comments

[2006-05-16 00:31 UTC] vitaly at yakovenko dot net

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

[2006-06-19 19:07 UTC] vitali at yakavenka dot net

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 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.