php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #16570 error control operator and set_error_handler()
Submitted: 2002-04-12 12:49 UTC Modified: 2002-04-13 09:29 UTC
From: alberty at neptunelabs dot de Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0CVS-2002-04-12 OS: i686-pc-linux-gnu
Private report: No CVE-ID: None
 [2002-04-12 12:49 UTC] alberty at neptunelabs dot de
Hi,

the @ Error Control Operator doesnt suppress warnings (e.g.:E_WARNING),
if an own error handler is declared.

the follow code snip demonstrate the problem:

<?php
error_reporting(E_ALL);
function error_handler ($errno, $errstr, $errfile, $errline) {
	echo "$errstr <br>in $errfile<br>line $errline<br>";
}

$old_error_handler = set_error_handler('error_handler');

$dbconnect=@mysql_pconnect('foobar-server', 'bart', 'simson');
?>

I think this is a bug, because this behavior is not documented.


Regards,

Steve

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-04-12 17:08 UTC] sniper@php.net
Not a bug. If @ is used, error_reporting is set to 0.
You need to take care of it yourself in your error handler
function if you don't want to show errors in that case.

This is done this way to let users have as much control
as possible in their own error handlers.

And it is documented here:

http://www.php.net/manual/en/function.set-error-handler.php

--Jani

 [2002-04-13 09:29 UTC] alberty at neptunelabs dot de
sorry, my mistake.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Apr 16 08:01:26 2025 UTC