#26006 [Opn->Bgs]: error_reporting() and @ problem

From: Date: Tue, 28 Oct 2003 03:41:14 +0000
Subject: #26006 [Opn->Bgs]: error_reporting() and @ problem
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-49551@lists.php.net to get a copy of this message
ID: 26006 Updated by: iliaa@php.net Reported By: gms08701 at yahoo dot com -Status: Open +Status: Bogus Bug Type: *General Issues Operating System: FreeBSD 4.8-RELEASE-p10 PHP Version: 4.3.3 New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php When you put an @ infront of a function or a language construct in this case all of the code performed by the function effectively has an error level of 0. Meaning that your error_reporting(0) inside y.php is not necessary as the error reporting is already at 0. Previous Comments: ------------------------------------------------------------------------ [2003-10-27 11:07:49] gms08701 at yahoo dot com Description: ------------ To my knowledge, when using @ at a function/variable/etc, it sets error_reporting to 0 at that instance, and return, to its previous state, after that instance. Unfortunately, after the instance of @, instead of returning to what it was set at previously, it returns to what is set in php.ini Reproduce code: --------------- --y.php-- <?php // error_reporting is currently at E_ALL (set from php.ini) // Set error_reporting to 0 error_reporting(0); // Returns 0 here var_dump(error_reporting()); ?> --z.php-- <?php @require('./y.php'); // This returns 2047 (E_ALL) var_dump(error_reporting()); ?> Expected result: ---------------- Its expected that z.php should return 0 from the var_dump(), where it inherits its error_reporting value from y.php, but is currently returning 2047 (E_ALL) When I remove '@' from require('./y.php'); in z.php, it then works correctly. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=26006&edit=1

« previous php.bugs (#49551) next »