473,387 Members | 3,033 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

set_error_handler returns

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
3 2730
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: JohnVT | last post by:
Hi. I mentioned this before, but I think my question got kind of lost. I'll make it one short question now. With set_error_handler('myErrorHandler') I bypass PHP's standard error handler,...
3
by: dan glenn | last post by:
hi. I want to code a 'preview' function into a guestbook entry page. I can do it with a button that posts, bringing up a whole new page showing a preview of what has been entered, and then the user...
7
by: zYm3N | last post by:
Hi ! It's my first post here: Hello everyone :-) Do you know why this code doesnt work ? Thanks for any help. <? echo('start<br>'); // redefine the user error constants - PHP 4 only...
5
by: lawrence | last post by:
If I call this function at the top of the page, does that mean that the function sendErrorsPhpToPds() is now called everytime there is an error? Does this still work if I also go...
5
by: lkrubner | last post by:
www.php.net says: >>>>>>>>>>>> Only for SELECT,SHOW,EXPLAIN or DESCRIBE statements mysql_query() returns a resource identifier or FALSE if the query was not executed correctly. For other type of...
23
by: rithish | last post by:
<code> var dt = new Date(2004, 0, 1); alert ( dt.getDate() ); // returns proper date alert ( dt.getUTCFullYear() ); // returns 2003 </code> Why is this so? Or is that I am missing...
4
by: ezra epstein | last post by:
Aother head banger for me. Below is a complete example of the code Using Postgres 7.4, the function "test" gets this: psql:temp3.sql:10: ERROR: syntax error at or near "%" at character 135...
5
by: Susan Geller | last post by:
Character returns stored in a table do not display in a textbox or on a datagrid on my .net form. The text displays without the returns making the text difficult to read. When I "view source" on...
4
by: Henning M | last post by:
Hej All Im relativ new to VB.net and im trying to collect som device information using cfgmgr32.dll I use - Declare Function GetListLength Lib "cfgmgr32.dll" Alias...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.