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


PHP PEAR_Error::getBacktrace方法代码示例

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


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

示例1: errorObjToString

    /**
     * A method to convert PEAR_Error objects to strings.
     *
     * @static
     * @param PEAR_Error $oError A {@link PEAR_Error} object
     */
    function errorObjToString($oError, $additionalInfo = null)
    {
        $aConf = $GLOBALS['_MAX']['CONF'];
        $message = htmlspecialchars($oError->getMessage());
        $debugInfo = htmlspecialchars($oError->getDebugInfo());
        $backtrace = htmlspecialchars($oError->getBacktrace());
        $additionalInfo = htmlspecialchars($additionalInfo);
        $level = $oError->getCode();
        $errorType = MAX::errorConstantToString($level);
        $img = MAX::constructURL(MAX_URL_IMAGE, 'errormessage.gif');
        // Message
        $output = <<<EOF
<br />
<div class="errormessage">
    <img class="errormessage" src="{$img}" align="absmiddle">
    <span class='tab-r'>{$errorType} Error</span>
    <br />
    <br />{$message}
    <br /><pre>{$debugInfo}</pre>
    {$additionalInfo}
</div>
<br />
<br />
EOF;
        return $output;
    }
开发者ID:villos,项目名称:tree_admin,代码行数:32,代码来源:Max.php

示例2: _getPearTrace

 /**
  * Return a trace for the PEAR error.
  *
  * @param PEAR_Error $error The PEAR error.
  *
  * @return string The backtrace as a string.
  */
 private function _getPearTrace(PEAR_Error $error)
 {
     $backtrace = $error->getBacktrace();
     if (!empty($backtrace)) {
         $pear_error = "\n\n" . 'PEAR Error:' . "\n";
         foreach ($backtrace as $frame) {
             $pear_error .= '    ' . (isset($frame['class']) ? $frame['class'] : '') . (isset($frame['type']) ? $frame['type'] : '') . (isset($frame['function']) ? $frame['function'] : 'unkown') . ' ' . (isset($frame['file']) ? $frame['file'] : 'unkown') . ':' . (isset($frame['line']) ? $frame['line'] : 'unkown') . "\n";
         }
         $pear_error .= "\n";
         return $pear_error;
     }
     return '';
 }
开发者ID:no-reply,项目名称:cbpl-vufind,代码行数:20,代码来源:Pear.php

示例3: __construct

 /**
  * @param PEAR_Error $error
  */
 public function __construct(PEAR_Error $error)
 {
     $message = $error->getMessage();
     $userInfo = $error->getUserInfo();
     if (!is_null($userInfo)) {
         $message .= ', ' . $userInfo;
     }
     parent::__construct($message);
     $backtrace = $error->getBacktrace();
     if (is_array($backtrace)) {
         $this->file = $backtrace[1]['file'];
         $this->line = $backtrace[1]['line'];
     }
 }
开发者ID:nyarla,项目名称:fluxflex-rep2ex,代码行数:17,代码来源:Exception.php

示例4: _getPearTrace

 /**
  * Return a trace for the PEAR error.
  *
  * @param PEAR_Error $error The PEAR error.
  *
  * @return string The backtrace as a string.
  */
 private function _getPearTrace(PEAR_Error $error)
 {
     $pear_error = '';
     $backtrace = $error->getBacktrace();
     if (!empty($backtrace)) {
         $pear_error .= 'PEAR backtrace:' . "\n\n";
         foreach ($backtrace as $frame) {
             $pear_error .= (isset($frame['class']) ? $frame['class'] : '') . (isset($frame['type']) ? $frame['type'] : '') . (isset($frame['function']) ? $frame['function'] : 'unkown') . ' ' . (isset($frame['file']) ? $frame['file'] : 'unkown') . ':' . (isset($frame['line']) ? $frame['line'] : 'unkown') . "\n";
         }
     }
     $userinfo = $error->getUserInfo();
     if (!empty($userinfo)) {
         $pear_error .= "\n" . 'PEAR user info:' . "\n\n";
         if (is_string($userinfo)) {
             $pear_error .= $userinfo;
         } else {
             $pear_error .= print_r($userinfo, true);
         }
     }
     return $pear_error;
 }
开发者ID:evltuma,项目名称:moodle,代码行数:28,代码来源:Pear.php

示例5: pearErrorHandler

/**
 * A callback function that sets the default PEAR Error behaviour.
 *
 * @static
 * @param PEAR_Error $oError A {@link PEAR_Error} object
 */
function pearErrorHandler($oError)
{
    $aConf = $GLOBALS['_MAX']['CONF'];
    // Log message
    $message = $oError->getMessage();
    $debugInfo = $oError->getDebugInfo();
    OA::debug('PEAR' . " :: {$message} : {$debugInfo}", PEAR_LOG_ERR);
    // If sesssion debug, send error info to screen
    $msg = '';
    if (empty($aConf['debug']['production'])) {
        $GLOBALS['_MAX']['ERRORS'][] = $oError;
    }
    // Add backtrace info
    if (!empty($aConf['debug']['showBacktrace'])) {
        $msg .= 'PEAR backtrace: <div onClick="if (this.style.height) {this.style.height = null;this.style.width = null;} else {this.style.height = \'8px\'; this.style.width=\'8px\'}"';
        $msg .= 'style="float:left; cursor: pointer; border: 1px dashed #FF0000; background-color: #EFEFEF; height: 8px; width: 8px; overflow: hidden; margin-bottom: 2px;">';
        $msg .= '<pre wrap style="margin: 5px; background-color: #EFEFEF">';
        ob_start();
        print_r($oError->getBacktrace());
        $msg .= ob_get_clean();
        $msg .= '<hr></pre></div>';
        $msg .= '<div style="clear:both"></div>';
    }
    if (defined('TEST_ENVIRONMENT_RUNNING')) {
        // It's a test, stop execution
        echo nl2br("Message: {$message}\ndebugInfo: {$debugInfo}\nbackTrace: {$msg}");
        exit(1);
    } elseif (defined('OA_WEBSERVICES_API_XMLRPC')) {
        // It's an XML-RPC response
        $oResponse = new XML_RPC_Response('', 99999, $message);
        echo $oResponse->serialize();
        exit;
    } else {
        // Send the error to the screen
        echo MAX::errorObjToString($oError, $msg);
    }
}
开发者ID:akirsch,项目名称:revive-adserver,代码行数:43,代码来源:Max.php

示例6: array

 /**
  * Push the error to the error stack.
  *
  * @param   object  $error  PEAR_Error  An error object
  * @return  void
  * @access  public
  * @static
  */
 function push_error(PEAR_Error $error)
 {
     self::errorstack()->push($error->getCode(), 'error', array('object' => $error), $error->getMessage(), false, $error->getBacktrace());
 }
开发者ID:bermi,项目名称:akelos,代码行数:12,代码来源:estraierpure.php


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