Jump to content

Suppressing errors with @


plutomed

Recommended Posts

The bit of code I'm using it on is:

if((@include("languages/".LANGUAGE.".php")) != 1)
{
require("languages/".DEFAULT_LANG.".php");
}

 

But the error is still be produced. I'm using a custom error handler, is there anyway to include the @ in the custom error handler?

Link to comment
Share on other sites

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() ;)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.