当前位置: 首页>>代码示例>>PHP>>正文


PHP ErrorHandler::start方法代码示例

本文整理汇总了PHP中ErrorHandler::start方法的典型用法代码示例。如果您正苦于以下问题:PHP ErrorHandler::start方法的具体用法?PHP ErrorHandler::start怎么用?PHP ErrorHandler::start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ErrorHandler的用法示例。


在下文中一共展示了ErrorHandler::start方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getDecodeJson

 public function getDecodeJson($key, $default = null)
 {
     ErrorHandler::start();
     $params = json_decode($this->getParam($key), $default);
     ErrorHandler::stop();
     return (array) $params;
 }
开发者ID:orbisnull,项目名称:orbistools,代码行数:7,代码来源:Request.php

示例2: getInstance

 /**
  * Retrieves singleton instance
  *
  * @return ErrorHandler
  */
 public static function getInstance($andStart = false)
 {
     if (self::$instance == null) {
         self::$instance = new self();
         if ($andStart) {
             self::$instance->start();
         }
     }
     return self::$instance;
 }
开发者ID:jpauli,项目名称:PHP-Observer-SPL-Pattern,代码行数:15,代码来源:ErrorHandler.php

示例3: systemGlob

 /**
  * Use the glob function provided by the system.
  *
  * @param  string  $pattern
  * @param  int     $flags
  * @return array
  * @throws Exception\RuntimeException
  */
 protected static function systemGlob($pattern, $flags)
 {
     if ($flags) {
         $flagMap = array(self::GLOB_MARK => GLOB_MARK, self::GLOB_NOSORT => GLOB_NOSORT, self::GLOB_NOCHECK => GLOB_NOCHECK, self::GLOB_NOESCAPE => GLOB_NOESCAPE, self::GLOB_BRACE => GLOB_BRACE, self::GLOB_ONLYDIR => GLOB_ONLYDIR, self::GLOB_ERR => GLOB_ERR);
         $globFlags = 0;
         foreach ($flagMap as $internalFlag => $globFlag) {
             if ($flags & $internalFlag) {
                 $globFlags |= $globFlag;
             }
         }
     } else {
         $globFlags = 0;
     }
     ErrorHandler::start();
     $res = glob($pattern, $globFlags);
     $err = ErrorHandler::stop();
     if ($res === false) {
         throw new Exception\RuntimeException("glob('{$pattern}', {$globFlags}) failed", 0, $err);
     }
     return $res;
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:29,代码来源:Glob.php

示例4: ob_clean

        ob_clean();
        $errorCase = array(E_WARNING => "Warning!", E_ERROR => "Error!", E_USER_ERROR => "User Error", E_USER_WARNING => "User Warning", E_USER_NOTICE => "User Notice");
        self::primitiveError(500, array_key_exists($errno, $errorCase) ? $errorCase[$errno] : "An unknown error occurred", $errstr . "<br/>Line " . $errline . " in " . $errfile);
    }
    public static function fatalHandler()
    {
        $error = error_get_last();
        if (self::$Enabled && $error !== null) {
            $errorMsg = $error['message'] . ' on line ' . $error['line'] . "<br/>(" . $error['file'] . ")";
            self::primitiveError(500, "Fatal error occurred", $errorMsg);
        }
    }
    private static $Enabled = false;
    public static function start()
    {
        error_reporting(0);
        self::$Enabled = true;
        set_error_handler(__CLASS__ . '::exceptionHandler', E_ALL);
        register_shutdown_function(__CLASS__ . '::fatalHandler');
    }
    public static function stop()
    {
        self::$Enabled = false;
        error_reporting(E_ALL);
        restore_error_handler();
        register_shutdown_function("exit");
    }
}
ErrorHandler::start();
@(include_once "engine/Engine.php") or ErrorHandler::primitiveError(500, "Missing Engine class.");
$engine = new Engine();
开发者ID:shaungeorge,项目名称:facebook_analyser,代码行数:31,代码来源:index.php

示例5: splitMessage

 public static function splitMessage($message, &$headers, &$body, $EOL = Mime\Mime::LINEEND, $strict = false)
 {
     if ($message instanceof Headers) {
         $message = $message->toString();
     }
     // check for valid header at first line
     $firstline = strtok($message, "\n");
     if (!preg_match('%^[^\\s]+[^:]*:%', $firstline)) {
         $headers = array();
         // TODO: we're ignoring \r for now - is this function fast enough and is it safe to assume noone needs \r?
         $body = str_replace(array("\r", "\n"), array('', $EOL), $message);
         return;
     }
     // see @ZF2-372, pops the first line off a message if it doesn't contain a header
     if (!$strict) {
         $parts = explode(':', $firstline, 2);
         if (count($parts) != 2) {
             $message = substr($message, strpos($message, $EOL) + 1);
         }
     }
     // find an empty line between headers and body
     // default is set new line
     if (strpos($message, $EOL . $EOL)) {
         list($headers, $body) = explode($EOL . $EOL, $message, 2);
         // next is the standard new line
     } elseif ($EOL != "\r\n" && strpos($message, "\r\n\r\n")) {
         list($headers, $body) = explode("\r\n\r\n", $message, 2);
         // next is the other "standard" new line
     } elseif ($EOL != "\n" && strpos($message, "\n\n")) {
         list($headers, $body) = explode("\n\n", $message, 2);
         // at last resort find anything that looks like a new line
     } else {
         ErrorHandler::start(E_NOTICE | E_WARNING);
         list($headers, $body) = preg_split("%([\r\n]+)\\1%U", $message, 2);
         ErrorHandler::stop();
     }
     $headers = Headers::fromString($headers, $EOL);
 }
开发者ID:naushrambo,项目名称:espocrm,代码行数:38,代码来源:Message.php


注:本文中的ErrorHandler::start方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。