plutomed Posted July 30, 2010 Share Posted July 30, 2010 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? Quote Link to comment Share on other sites More sharing options...
onlyican Posted July 30, 2010 Share Posted July 30, 2010 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'); } Quote Link to comment Share on other sites More sharing options...
plutomed Posted July 30, 2010 Author Share Posted July 30, 2010 Now thats an even better idea. 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() Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.