Re: Fatal Errors and Error Handling
| From: | Christian Reiniger | Date: | Tue, 24 Apr 2001 14:11:43 +0000 |
| Subject: | Re: Fatal Errors and Error Handling | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-50078@lists.php.net to get a copy of this message | ||
On Tuesday 24 April 2001 14:47, Boget, Chris wrote:
> > > My problem is that not displaying anything in case of an error is a
> > > completely unacceptable solution. I *MUST* return a valid
> > > XML message in a predefined format. If not, I am violating the
> >
> > standard we are
> > if (@foo_bar (42, 4711) == ERROR_CODE) {
> > PrintXMLErrorMessage ();
>
> I do not believe the above will work. When using the "@" symbol
> in front of an expression, it makes it so that the error code that is
> returned is "0". While writing my error handler class, in the
Wrong. From http://php.net/manual/en/language.operators.errorcontrol.php
:
------
PHP supports one error control operator: the at sign (@). When prepended
to an expression in PHP, any error messages that might be generated by
that expression will be ignored.
------
The @ operator suppresses any error *message*, but leaves the return
value intact.
Just imagine that with your interpretation in the following snippet
$conn = @mysql_connect(...)
$conn would always be set to 0...
--
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)
I sat laughing snidely into my notebook until they showed me a PC running
Linux. And oh! It was as though the heavens opened and God handed down a
client-side OS so beautiful, so graceful, and so elegant that a million
Microsoft developers couldn't have invented it even if they had a hundred
years and a thousand crates of Jolt cola.
- LAN Times