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

  • Home
  • SEARCH
  • 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 7955475
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T03:43:14+00:00 2026-06-04T03:43:14+00:00

Well… This is my case: I’m developing a framework and I’m current developing the

  • 0

Well… This is my case: I’m developing a framework and I’m current developing the error handling feature. I want handle error handling errors too! Well… explaining better: If I have an error, fatal or not, is thrown an exception (in case of non fatal errors) and faked Exception for fatal errors. The exceptions are handled by “loggers”, which can treat the error echo it on console (browser) or store it on a file. The problem is when occurs a second FATAL error inside loggers. To catch it I’m using PHP buffer (ob_start()). Inside this function should never occurs an error, anyone…. In the other words… this is last level of the error tracing. I could just echo the error, but I want register them using PHP error log system (disabled if not reach last level). This is possible using error_log function. In PHP documentation for error_log function:

“Returns TRUE on success or FALSE on failure.”

Well… this what I need. But I’m afraid because I don’t know if this function could generate fatal error (internal implementation) or just return TRUE/FALSE. I tested using mail option (1) in localhost SMTP and this failed (as expected!), generating a warning message. Then buffer crashes displaying blank page on browser (this is what I don’t want happen). This problem could be solved checking smtp connectivity with fsockopen and attribuiting the return value to a class variable. Inside buffer function this variable value is verified. If is TRUE, error_log with email option is called. But in the case of error_log with options 0 (php file log) and 3 (other files)?

This goes the relevant part of my logging class:

    public function error_buffer($buffer) {

        $error = error_get_last ();

        if ($error && ($error ['type'] & E_FATAL && $this->_errhe)) {

            $this->error_handler_error ( $error ['type'], $error ['message'], $error ['file'], $error ['line'] );

            if (ENV === 'production') {
                return 'error 500';
            }

            return ob_get_contents ();

        }

        return $buffer;

    }

    public function error_handler_error($errno, $errmsg, $errfile, $errline) {

            var_dump ( $errfile );

            /* GENERATES WARNING MESSAGE... AND BLANK PAGE! 
             *  Here is possible to do: if($this->_email) { error_log() }...
            */
            @error_log ( $errmsg, 1, 'lucas@lucas.com' );

            // error_log($errmsg, 0);

    }
  • 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-06-04T03:43:15+00:00Added an answer on June 4, 2026 at 3:43 am

    The @ doesn’t stop an error from hapenning, it only stops it from being displayed. So if mail() fails, then error_log to email (options 1) will also fail – with an error.

    Therefore, what is probably happening is that error_log() call causes an error that calls your error handling function, that calls error_log() that causes an error that calls your error handling function, that calls error_log() that causes an error that calls your error handling function, that calls error_log() that causes an error that…. you get the gist.

    If that’s the case, the solutions I can quickly think of are:

    1 – to include a static variable in error_buffer to say “I’m currently handling an error, don’t handle any more (or simply display the message on screen – but honor the ini setting “display_errors”).

    2 – to turn off your error handling when in your error function to default PHP functions handle it.

    Why not make a call to “error_log ( $errmsg, 1, ‘lucas@lucas.com’ );” outside the error function (with our without the @) and see if you error handler is being called?

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

Sidebar

Related Questions

Well, how to create picture link like this up or down votes (on the
Well it's not realy causing any errors. Anyways i'm sending ajax request and getting
Well, this is an interesting problem. I have an ASP.NET MVC3 Intranet application running
Well i currently want to do a search engine with SQL and PHP. I
Well, this must be a silly one. Here below is a can-not-be-simpler code in
Well it is definitely way faster than the built-in Web-Browser component of .Net Framework.
Well I have a view of this type of hierarchy Main View (having some
Well, I've looked all over the internet, and it appears that what I want
Well, it may actually be a simple case but I'm having a tough time
Well friends, I have got this query which works but is very long for

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.