Capture Mustache warnings to be logged for debugging.

@param $errno
@param $errstr
@param $errfile
@param $errline

@return bool
979176
private function handleMustacheErrors($errno, $errstr, $errfile, $errline)
    {
        if (!empty($this->lastTemplate)) {
            if (function_exists('newrelic_add_custom_parameter')) {
                call_user_func(
                    'newrelic_add_custom_parameter',
                    'contactclientToken',
                    $this->lastTemplate
                );
            }
        }
        if (!empty($this->context)) {
            if (function_exists('newrelic_add_custom_parameter')) {
                call_user_func(
                    'newrelic_add_custom_parameter',
                    'contactclientContext',
                    json_encode($this->context)
                );
            }
        }
        $this->logger->error(
            'Contact Client '.$this->contactClient->getId().
            ': Warning issued with Template: '.$this->lastTemplate.' Context: '.json_encode($this->context)
        );

        return true;
    }
1310495
public static function error($errno, $errstr, $errfile = '', $errline = 0, $errcontext = [])
    {
        $exception = new Exception($errno, $errstr, $errfile, $errline, $errcontext);

        if (error_reporting() & $errno) {
            throw $exception;
        }
    }
185041
public function on_error( $num, $str, $file, $line, $context = NULL ) {

		$log_context = [];
		if ( $context ) {
			$skip_keys   = array_merge( array_keys( $GLOBALS ), self::$super_globals_keys );
			$skip        = array_fill_keys( $skip_keys, '' );
			$log_context = array_filter( array_diff_key( (array) $context, $skip ) );
		}

		$log_context[ 'file' ] = $file;
		$log_context[ 'line' ] = $line;

		// Log the PHP error.
		do_action(
			\Inpsyde\Wonolog\LOG,
			new Log( $str, self::$errors_level_map[ $num ], Channels::PHP_ERROR, $log_context )
		);

		return FALSE;
	}
552364
protected function _errorhandler_file($errstr, $backtrace, $errortype) {
		$body  = '############################## '.$errortype."\n";
		$body .= 'Datum:      '.date("d.m.Y - H:i:s")."\n";
		
		if (isset($_SERVER['REQUEST_URI'])) {
			$body .= 'URL:        '.$_SERVER['REQUEST_URI']."\n";
			$body .= 'IP:         '.$_SERVER['REMOTE_ADDR']."\n";
			$body .= 'User-Agent: '.(isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '-') ."\n";
		} else {
			$body .= 'CLI:        '.(implode(' ', $_SERVER['argv']))."\n";
		}

		$body .= 'Meldung:    '.$errstr."\n";
		$body .= 'Backtrace:  '."\n\n";

		foreach ($backtrace as $value) {
			$body .= '       File: '.$value['file']." (Line ".$value['line'].")\n";
			$body .= '   Function: '.$value['class'].$value['type'].$value['function'].'()'."\n\n";
		}
		$body .= "\n";

		file_put_contents($this->_logfile, $body, FILE_APPEND);
	}
1147819
public function trapXMLError($errno, $errstr, $errfile, $errline)
    {
        $this->__error($errno, str_replace('DOMDocument::', null, $errstr), $errfile, $errline, 'xml');
    }
1003664
public static function appError($errno, $errstr, $errfile = '', $errline = 0)
    {
        if (error_reporting() & $errno) {
            // 委托给异常处理
            if (self::isFatalWarning($errno, $errstr)) {
                self::appException(new \Mix\Exception\ErrorException($errno, $errstr, $errfile, $errline));
                return;
            }
            // 转换为异常抛出
            throw new \Mix\Exception\ErrorException($errno, $errstr, $errfile, $errline);
        }
    }
1191924
public function error($errno, $errstr)
    {
        if ($errno === E_RECOVERABLE_ERROR) {
            $name = $this->getName();
            $route = $name ? $name : $this->getActionName();
            throw new CatchableFatalErrorException($route, $errstr);
        }
    }
1145072
public static function errorHandler($errno, $error, $file, $line) {
		// if its a javascript error submitted to backend
		if ($errno == 'javascript') {
			\Debug::$data['js'][] = [
				'errno' => $errno,
				'error' => [$error],
				'file' => $file,
				'line' => $line,
				'code' => '',
				'backtrace' => []
			];
		} else if (error_reporting() !== 0) { // important: we do not process suppressed errors
			self::$errors[] = [
				'errno' => $errno,
				'error' => [$error],
				'file' => $file,
				'line' => $line,
				'code' => self::getCode($file, $line),
				'backtrace' => self::debugBacktraceString()
			];
		} else if (\Debug::$debug) {
			\Debug::$data['suppressed'][] = [
				'errno' => $errno,
				'error' => [$error],
				'file' => $file,
				'line' => $line,
				'code' => self::getCode($file, $line),
				'backtrace' => self::debugBacktraceString()
			];
		}
		// hashing errors
		if ($errno != 'javascript') {
			if (!isseT(self::$error_hashes_intersepted[$file][$line])) {
				self::$error_hashes_intersepted[$file][$line] = [];
			}
			self::$error_hashes_intersepted[$file][$line][] = ['errno' => $errno, 'error' => $error];
		}
	}
268259
public function handler($errno, $errstr, $errfile, $errline)
    {
        throw new \ErrorException($errstr, $errno, 0, $errfile, $errline);
    }
1005545
public static function customErrorHandler($errno, $errstr, $errfile, $errline) {
	
		$backtrace = self::getDebugBacktrace();

		// command line log has date and plain text
		if ('cli' == php_sapi_name()) {

			print "\n" . date(DATE_RFC2822) . "\n";
			print "Error [" . $errno . ']: ' . $errstr . ' (' . $errfile . ' line ' . $errline . ")\n";

			if ($backtrace) {
				print "Debug backtrace:\n" . implode("\n", $backtrace) . "\n";
		}
	
		// list all errors in framework log
		} else {
			
			if (Options::get('show_log')) {

				$logger = Logger::getInstance();
			
				// start to show detailed error in log event
				$logger->addError('Debug backtrace for “' . $errstr .  '” in ' . $errfile . ' line ' . $errline);
	
				foreach ($backtrace as $event) {
					$logger->addEvent($event);
				}
	
				$logger->addEvent('Debug backtrace finished');
	
			// show error in app because log is disabled
			} else {
			
				$app = Application::getInstance();
				$app->enqueueError($errstr . ' (' . $errfile . ' line ' . $errline .')', 'Error [' . $errno . ']');
		
			}
	
		}
	
	}
202941
public static function error_handler( $errno, $errstr, $errfile, $errline, $errcontext = null ) {
		// If ignoring E_USER_WARNING | E_USER_NOTICE, default.
		if ( ! ( error_reporting() & $errno ) ) {
			return false;
		}
		// If not in "wp-includes/update.php", default.
		$update_php = 'wp-includes/update.php';
		if ( 0 !== substr_compare( $errfile, $update_php, -strlen( $update_php ) ) ) {
			return false;
		}
		// Else assume it's in `wp_update_themes()` or `wp_update_plugins()` and just ignore it.
		return true;
	}
31358
public static function errorHandler($errno, $errstr, $errfile, $errline, $errcontext)
    {
        Daemon::$noError = false;
        $l = error_reporting();
        if ($l === 0) {
            if (!Daemon::$restrictErrorControl) {
                return;
            }
        } elseif (!($l & $errno)) {
            return;
        }

        static $errtypes = [
            E_ERROR => 'Fatal error',
            E_WARNING => 'Warning',
            E_PARSE => 'Parse error',
            E_NOTICE => 'Notice',
            E_PARSE => 'Parse error',
            E_USER_ERROR => 'Fatal error (userland)',
            E_USER_WARNING => 'Warning (userland)',
            E_USER_NOTICE => 'Notice (userland)',
            E_STRICT => 'Notice (userland)',
            E_RECOVERABLE_ERROR => 'Fatal error (recoverable)',
            E_DEPRECATED => 'Deprecated',
            E_USER_DEPRECATED => 'Deprecated (userland)',
        ];
        $errtype = $errtypes[$errno];
        Daemon::log($errtype . ': ' . $errstr . ' in ' . $errfile . ':' . $errline . "\n" . Debug::backtrace());
        if (Daemon::$context instanceof \PHPDaemon\Request\Generic) {
            Daemon::$context->out('<strong>' . $errtype . '</strong>: ' . $errstr . ' in ' . basename($errfile) . ':' . $errline . '<br />');
        }
    }
1144963
public function setErrorHandle($err, $message, $file, $line) {
        $oJsonRpc = JsonRpc::getInstance();
        $content = explode("\n", file_get_contents($file));
        header('Content-Type: application/json');
        $id = $oJsonRpc->extractId();
        $error = array(
           "code" => 100,
           "message" => "Server error",
           "error" => array(
              "name" => "PHPErorr",
              "code" => $err,
              "message" => $message,
              "file" => $file,
              "at" => $line,
              "line" => $content[$line-1]));
        ob_end_clean();
        echo $oJsonRpc->response(null, $id, $error);
        exit();
    }
1291858
private function createPhpError($errno, $errstr, $errfile, $errline) {
		switch($errno) {
			case E_ERROR:
// 				if (!is_null($exception = $this->checkForTypeLoaderException($errno, $errstr, $errfile, $errline))) {
// 					return $exception;
// 				}
			case E_USER_ERROR:
			case E_COMPILE_ERROR:
			case E_CORE_ERROR:
				return new FatalError($errstr, $errno, $errfile, $errline);
			case E_WARNING:
			case E_USER_WARNING:
			case E_COMPILE_WARNING:
			case E_CORE_WARNING:
				return new WarningError($errstr, $errno, $errfile, $errline);
			case E_NOTICE:
			case E_USER_NOTICE:
				return new NoticeError($errstr, $errno, $errfile, $errline);
			case E_RECOVERABLE_ERROR:
				return new RecoverableError($errstr, $errno, $errfile, $errline);
			case E_STRICT:
				return new StrictError($errstr, $errno, $errfile, $errline);
			case E_PARSE:
				return new ParseError($errstr, $errno, $errfile, $errline);
			case E_DEPRECATED:
			case E_USER_DEPRECATED:
				return new DeprecatedError($errstr, $errno, $errfile, $errline);
			default:
				return new FatalError($errstr, $errno, $errfile, $errline);
		}
	}
207587
public function errorHandler($errno, $errstr, $file, $line)
    {
        switch ($errno) {
            case E_USER_ERROR:
            case E_ERROR:
            case E_RECOVERABLE_ERROR:
                $this->logger->addError($errstr, array($file, $line));
                exit();
                break;
            case E_WARNING:
            case E_USER_WARNING:
                $this->logger->addWarning($errstr, array($file, $line));
                break;
            default:
                $this->logger->addInfo($errstr, array($file, $line));
                break;
        }
    }
582094
public static function errorHandler($errno, $errstr, $errfile = null, $errline = null, $errcontext = null)
    {
        return true;
    }
432781
public static function handleError($__exc_errno, $__exc_errstr, $__exc_errfile, $__exc_errline, $__exc_errcontext)
    {
        // If a command is called with "@", then we should return
        if (error_reporting() == 0) {
            return true;
        }

        if (class_exists('\QApplicationBase')) {
            \QApplicationBase::$ErrorFlag = true;
        }

        global $__exc_strType;
        if (isset($__exc_strType)) {
            return true;
        } // Already handled elsewhere, avoi looping

        $__exc_strType = "Error";
        //$__exc_strMessage = $__exc_errstr;

        switch ($__exc_errno) {
            case E_ERROR:
                $__exc_strObjectType = "E_ERROR";
                break;
            case E_WARNING:
                $__exc_strObjectType = "E_WARNING";
                break;
            case E_PARSE:
                $__exc_strObjectType = "E_PARSE";
                break;
            case E_NOTICE:
                $__exc_strObjectType = "E_NOTICE";
                break;
            case E_STRICT:
                $__exc_strObjectType = "E_STRICT";
                break;
            case E_CORE_ERROR:
                $__exc_strObjectType = "E_CORE_ERROR";
                break;
            case E_CORE_WARNING:
                $__exc_strObjectType = "E_CORE_WARNING";
                break;
            case E_COMPILE_ERROR:
                $__exc_strObjectType = "E_COMPILE_ERROR";
                break;
            case E_COMPILE_WARNING:
                $__exc_strObjectType = "E_COMPILE_WARNING";
                break;
            case E_USER_ERROR:
                $__exc_strObjectType = "E_USER_ERROR";
                break;
            case E_USER_WARNING:
                $__exc_strObjectType = "E_USER_WARNING";
                break;
            case E_USER_NOTICE:
                $__exc_strObjectType = "E_USER_NOTICE";
                break;
            case E_DEPRECATED:
                $__exc_strObjectType = 'E_DEPRECATED';
                break;
            case E_USER_DEPRECATED:
                $__exc_strObjectType = 'E_USER_DEPRECATED';
                break;
            case E_RECOVERABLE_ERROR:
                $__exc_strObjectType = 'E_RECOVERABLE_ERROR';
                break;
            default:
                $__exc_strObjectType = "Unknown";
                break;
        }

        $__exc_strFilename = $__exc_errfile;
        $__exc_intLineNumber = $__exc_errline;

        $__exc_strStackTrace = QcubedGetBacktrace();

        if (ob_get_length()) {
            $__exc_strRenderedPage = ob_get_contents();
            ob_clean();
        }

        // Call to display the Error Page (as defined in configuration.inc.php)
        if (defined('QCUBED_ERROR_PAGE_PHP')) {
            require(__DOCROOT__ . QCUBED_ERROR_PAGE_PHP);
        } else {
            // Error in installer or similar - QCUBED_ERROR_PAGE_PHP constant is not defined yet.
            echo "error: errno: " . $__exc_errno . "<br/>" . $__exc_errstr . "<br/>" . $__exc_errfile . ":" . $__exc_errline . "<br/>" . implode(', ',
                    $__exc_errcontext);
        }
        exit();
    }