Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6560731
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:29:56+00:00 2026-05-25T13:29:56+00:00

I am following good programming practices and I am logging the PHP errors to

  • 0

I am following good programming practices and I am logging the PHP errors to file instead of displaying it to user. I use set_error_handler() for that.

Now the problem. For example, I have somewhere:

@file_exists('/some/file/that/is/outside/openbasedir.txt');

But despite the error suppression operator, the error message logs. I don’t want that. I want suppressed errors not to pass to my error handler.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T13:29:57+00:00Added an answer on May 25, 2026 at 1:29 pm

    This answer applies at PHP 7:

    The @ operator temporarily sets error_reporting to 0, so you can test the value of error_reporting in your error handler:

    if (error_reporting() == 0)
        return;
    

    Or even better, log only error types that are in error_reporting:

    $error_reporting = error_reporting();
    if ( !($error_reporting & $errno) )
        return;
    

    Also take a look at the log_errors and error_log options, for automatically logging errors to a file or to syslog.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just wondering if the following is considered to be good programming practice or not?
What would be a good set of programming exercises that would help Python newbies
I am not very good at programming, I try to make the following radio
Please let me know which of the following is a good programming practise: 1.
Is following code, a good programming practice in objective-C ? #import Custom.h @interface Custom
I'm programming a Monte-Carlo Simulation that should give the user quite some flexibility. Consequently,
Following this question: Good crash reporting library in c# Is there any library like
The following page looks good in Firefox, Safari, Chrome, IE6 and IE8... but it
I'm following this tutorial (seems good) for Rails. After I run ruby script/generate scaffold
I'm looking for a good pattern to resolve the following circular reference in a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.