Jump to content

Suppressing errors with @


plutomed

Recommended Posts

I would be tempted to check if the file exists rather than trying to include a file and going by an error to see if the file exists

 

http://uk.php.net/manual/en/function.file-exists.php

if(file_exists('languages/'.LANGUAGE.'.php)){
include('languages/'.LANGUAGE.'.php');
}else{
include('languages/'.DEFAULT_LANG.'.php');
}

Now thats an even better idea. :D How stupid of me to not think of that.

 

Even though that has solved my problem. I was reading in the php manual:

It is important to remember that the standard PHP error handler is completely bypassed for the error types specified by error_types unless the callback function returns FALSE. error_reporting() settings will have no effect and your error handler will be called regardless - however you are still able to read the current value of error_reporting and act appropriately. Of particular note is that this value will be 0 if the statement that caused the error was prepended by the @ error-control operator.

 

If I wanted to see if the @ was there error_reporting will return 0. But I think it will be the best idea to use file_exists() ;)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.