By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,722 Members | 1,904 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,722 IT Pros & Developers. It's quick & easy.

set_error_handler returns

P: n/a
Hi everyone,

In the documentation it says that set_error_handler will return
'Returns a string containing the previously defined error handler (if
any), or NULL on error.'

However, in my experience, set_error_handler also returns NULL if the
previous handler was the default PHP error handler.

Is this the case?

Secondly, has anyone ever experienced output *not* buffering even
though output was turned on?

I'm using the SoapClient class

<code>

ob_start();
use_soap_error_handler(false); // in case the soap handler is
interfering
$this->m_soapClient = new SoapClient($wsdlURL);
$msg = ob_get_contents();
ob_end_clean(); // ob_end_flush stuffs up headers

</code>

If you feed the above code a bogus WSDL url, it still outputs:

Warning: SoapClient::SoapClient() [function.SoapClient-SoapClient]: I/
O warning : failed to load external entity "/forums/tests_common/
malformedWSDL.txt" in C:\data\projects\forums\src\includes
\PLCAuthService.class.php on line 46

(and also throws an exception)

Very weird - possibly a bug?

Thanks

Taras
Sep 16 '08 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Taras_96 wrote:
Hi everyone,

In the documentation it says that set_error_handler will return
'Returns a string containing the previously defined error handler (if
any), or NULL on error.'

However, in my experience, set_error_handler also returns NULL if the
previous handler was the default PHP error handler.

Is this the case?
Well, since the default error handler isn't a user-defined function, I
suspect that's the case.
Secondly, has anyone ever experienced output *not* buffering even
though output was turned on?

I'm using the SoapClient class

<code>

ob_start();
use_soap_error_handler(false); // in case the soap handler is
interfering
$this->m_soapClient = new SoapClient($wsdlURL);
$msg = ob_get_contents();
ob_end_clean(); // ob_end_flush stuffs up headers

</code>

If you feed the above code a bogus WSDL url, it still outputs:

Warning: SoapClient::SoapClient() [function.SoapClient-SoapClient]: I/
O warning : failed to load external entity "/forums/tests_common/
malformedWSDL.txt" in C:\data\projects\forums\src\includes
\PLCAuthService.class.php on line 46

(and also throws an exception)

Very weird - possibly a bug?

Thanks

Taras
Warnings and errors are not buffered. But on a production system, you
should have display_errors=off in your php.ini file.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Sep 16 '08 #2

P: n/a
On Sep 16, 10:08*pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
Taras_96 wrote:
Hi everyone,
In the documentation it says that set_error_handler will return
'Returns a string containing the previously defined error handler (if
any), or NULL on error.'
However, in my experience, set_error_handler also returns NULL if the
previous handler was the default PHP error handler.
Is this the case?

Well, since the default error handler isn't a user-defined function, I
suspect that's the case.
The documentation is misleading in this case.. I'll file a bug to get
this altered.
>

Secondly, has anyone ever experienced output *not* buffering even
though output was turned on?
I'm using the SoapClient class
<code>
ob_start();
use_soap_error_handler(false); // in case the soap handler is
interfering
$this->m_soapClient = new SoapClient($wsdlURL);
$msg = ob_get_contents();
ob_end_clean(); // ob_end_flush stuffs up headers
</code>
If you feed the above code a bogus WSDL url, it still outputs:
Warning: SoapClient::SoapClient() [function.SoapClient-SoapClient]: I/
O warning : failed to load external entity "/forums/tests_common/
malformedWSDL.txt" in C:\data\projects\forums\src\includes
\PLCAuthService.class.php on line 46
(and also throws an exception)
Very weird - possibly a bug?
Thanks
Taras

Warnings and errors are not buffered. *But on a production system, you
should have display_errors=off in your php.ini file.
Is this stated anywhere? I trudged through the PHP manual and couldn't
find anything to this effect. Also, the code below successfully
buffers the error... commenting the buffering directives results in
the notice being displayed, having output buffering on results in only
the word 'finish' being displayed (which is in contradiction to the
behaviour you stated)

<?php
ob_start();
trigger_error('blah'); <- this gives a notice
trigger_error('should be a warning',E_USER_WARNING);
ob_end_clean();

echo 'finish';
?>

Thanks

Taras
Sep 17 '08 #3

P: n/a
Taras_96 wrote:
On Sep 16, 10:08 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
>Taras_96 wrote:
>>Hi everyone,
In the documentation it says that set_error_handler will return
'Returns a string containing the previously defined error handler (if
any), or NULL on error.'
However, in my experience, set_error_handler also returns NULL if the
previous handler was the default PHP error handler.
Is this the case?
Well, since the default error handler isn't a user-defined function, I
suspect that's the case.

The documentation is misleading in this case.. I'll file a bug to get
this altered.
>>
>>Secondly, has anyone ever experienced output *not* buffering even
though output was turned on?
I'm using the SoapClient class
<code>
ob_start();
use_soap_error_handler(false); // in case the soap handler is
interfering
$this->m_soapClient = new SoapClient($wsdlURL);
$msg = ob_get_contents();
ob_end_clean(); // ob_end_flush stuffs up headers
</code>
If you feed the above code a bogus WSDL url, it still outputs:
Warning: SoapClient::SoapClient() [function.SoapClient-SoapClient]: I/
O warning : failed to load external entity "/forums/tests_common/
malformedWSDL.txt" in C:\data\projects\forums\src\includes
\PLCAuthService.class.php on line 46
(and also throws an exception)
Very weird - possibly a bug?
Thanks
Taras
Warnings and errors are not buffered. But on a production system, you
should have display_errors=off in your php.ini file.

Is this stated anywhere? I trudged through the PHP manual and couldn't
find anything to this effect. Also, the code below successfully
buffers the error... commenting the buffering directives results in
the notice being displayed, having output buffering on results in only
the word 'finish' being displayed (which is in contradiction to the
behaviour you stated)

<?php
ob_start();
trigger_error('blah'); <- this gives a notice
trigger_error('should be a warning',E_USER_WARNING);
ob_end_clean();

echo 'finish';
?>

Thanks

Taras
This is a user generated error, not a PHP generated one. An entirely
different thing.

No, I don't know where it is documented - but I do know that is how it
works.

And that's also why it's documented you should have display_errors=off
in a production system.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Sep 17 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.