title: Can PHP error_log function generate a fatal error inside buffer?
body: <p>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:</p>
  
  <p>"Returns TRUE on success or FALSE on failure."</p>
  
  <p>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)? </p>
  
  <p>This goes the relevant part of my logging class:</p>
  
  <pre><code>    public function error_buffer($buffer) {
  
          $error = error_get_last ();
  
          if ($error &amp;&amp; ($error ['type'] &amp; E_FATAL &amp;&amp; $this-&gt;_errhe)) {
  
              $this-&gt;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-&gt;_email) { error_log() }...
              */
              @error_log ( $errmsg, 1, 'lucas@lucas.com' );
  
              // error_log($errmsg, 0);
  
      }
  </code></pre>