#50729 [Bgs]: Error Control Operator (@) Does Not Work With Custom Error Handler
| From: | keithdavis at solidtechservice dot com | Date: | Tue, 12 Jan 2010 18:27:14 +0000 |
| Subject: | #50729 [Bgs]: Error Control Operator (@) Does Not Work With Custom Error Handler | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-146584@lists.php.net to get a copy of this message | ||
ID: 50729
User updated by: keithdavis at solidtechservice dot com
Reported By: keithdavis at solidtechservice dot com
Status: Bogus
Bug Type: Scripting Engine problem
Operating System: Windows 7 64 Bit
PHP Version: 5.3.1
New Comment:
Ok, I get it now, but I feel like the manual is very unclear on this
subject. I posted this problem in Experts Exchange and we couldn't
figure it out there either.
It reads to me that the "ERROR LEVEL" or error number is being set to
0, not the "ERROR REPORTING LEVEL".
Thanks for your help.
Previous Comments:
------------------------------------------------------------------------
[2010-01-12 18:19:21] rasmus@php.net
Just check it:
if(error_reporting()==0) ...
I'm confused about your confusion here.
------------------------------------------------------------------------
[2010-01-12 18:11:33] keithdavis at solidtechservice dot com
That makes no sense. How am I to determine in my error handler that the
error control operator is being used?
------------------------------------------------------------------------
[2010-01-12 17:01:01] degeberg@php.net
On my setup using PHP 5.3.1, this code:
<?php
function myErrorHandler($errno, $errstr, $errfile, $errline)
{
var_dump(error_reporting());
}
set_error_handler('myErrorHandler', E_ALL);
var_dump(error_reporting());
@include 'does-not-exist.php';
var_dump(error_reporting());
?>
Produces the following output:
int(32767)
int(0)
int(0)
int(32767)
It is your own responsibility to check the error handling level inside
your custom error handler.
------------------------------------------------------------------------
[2010-01-12 15:17:50] keithdavis at solidtechservice dot com
The manual states
"Of particular note is that this value will be 0 if the statement that
caused the error was prepended by the @ error-control operator. "
This is NOT happening.
------------------------------------------------------------------------
[2010-01-12 15:15:27] keithdavis at solidtechservice dot com
But it's NOT setting the error reporting to 0. It is a bug, see this
reply to a bug done in 2002.
http://bugs.php.net/bug.php?id=16570&edit=2
When I use the @, it is supposed to pass an error level of 0, but it
does not do this. It still sets it to 1024 and does NOT set my reporting
level to 0.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/50729
--
Edit this bug report at http://bugs.php.net/?id=50729&edit=1