error_reporting being set to 0

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

error_reporting being set to 0

Post by Ollie Saunders »

Somewhere, somehow in my code error_reporting is being set to 0 when it shouldn't be. I've done searches for any ini_sets and calls to error_reporting and I can't find a single place where it could possibly be set to 0. Does anybody have any idea what might set error_reporting to 0 as a side-effect or how I could find out the point at which error_reporting is changed?
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

You may try

Code: Select all

; This directive allows you to disable certain functions for security reasons.
; It receives a comma-delimited list of function names. This directive is
; *NOT* affected by whether Safe Mode is turned On or Off.
disable_functions = error_reporting,ini_set
in your php.ini
You'll get something like Warning: error_reporting() has been disabled for security reasons in file:line
phpinfo() shows a value != 0 for both global and local settings?
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Post by Ollie Saunders »

Thanks for your help volka. Don't worry for now, I'm not sure was is going on here.
For now things are working.
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Post by Ollie Saunders »

Ahhh Ha!

Code: Select all

if (!@include $fileToLoad) {
Results in that file starting with error_reporting set to 0.

Which begs another question what is the best way of checking if a file can be included or not?
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

file_exists(). I think there was a post around here at one point that brought up the fact that if you use error suppression on an include it acts as a global error suppressor for the entire file (or something to that effect).
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Post by Ollie Saunders »

Hehe, you know what Everah, I think that was my post.
But I didn't realise that error supression set error_reporting, I thought it was some other hidden value.

I don't see anything in the manual that say file_exists() checks the include paths.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

ole wrote:I don't see anything in the manual that say file_exists() checks the include paths.
Sorry, I think I misunderstood you on that one. I am not sure if there is anything that checks include paths.
Post Reply