php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #17438 error_reporting() does not work if @ is placed before the function
Submitted: 2002-05-26 14:02 UTC Modified: 2002-05-26 14:21 UTC
From: ilia at prohost dot org Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 4.2.1 OS: Linux 2.4.18
Private report: No CVE-ID: None
 [2002-05-26 14:02 UTC] ilia at prohost dot org
Changing the error reporting level inside a scirpt useing the error_reporting() function does not work if @ is present before the function.

Ex.
(assuming php.ini has error_reporting set to E_ALL)

<?php
@error_reporting(E_ALL^E_NOTICE);
echo $a;
?>

Would still generate a warning about an undefined variable.

<?php
error_reporting(E_ALL^E_NOTICE);
echo $a;
?>

Works fine without any warnings.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-05-26 14:21 UTC] derick@php.net
This is not a bug, the error_reporting value is deliberately modified by @ (it's set to 0 before the call to the function, and restored to the original value from before the call). Thus the modified value gets lost here.
Feel free to open this as a feature request if you find it really neccesairy to make this work.

Derick
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Aug 06 07:00:03 2025 UTC