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


PHP xdebug_get_function_stack函数代码示例

本文整理汇总了PHP中xdebug_get_function_stack函数的典型用法代码示例。如果您正苦于以下问题:PHP xdebug_get_function_stack函数的具体用法?PHP xdebug_get_function_stack怎么用?PHP xdebug_get_function_stack使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: __construct

 /**
  * Constructs the exception.
  * @link http://php.net/manual/en/errorexception.construct.php
  * @param $message [optional]
  * @param $code [optional]
  * @param $severity [optional]
  * @param $filename [optional]
  * @param $lineno [optional]
  * @param $previous [optional]
  */
 public function __construct($message = '', $code = 0, $severity = 1, $filename = __FILE__, $lineno = __LINE__, \Exception $previous = null)
 {
     parent::__construct($message, $code, $severity, $filename, $lineno, $previous);
     if (function_exists('xdebug_get_function_stack')) {
         $trace = array_slice(array_reverse(xdebug_get_function_stack()), 3, -1);
         foreach ($trace as &$frame) {
             if (!isset($frame['function'])) {
                 $frame['function'] = 'unknown';
             }
             // XDebug < 2.1.1: http://bugs.xdebug.org/view.php?id=695
             if (!isset($frame['type']) || $frame['type'] === 'static') {
                 $frame['type'] = '::';
             } elseif ($frame['type'] === 'dynamic') {
                 $frame['type'] = '->';
             }
             // XDebug has a different key name
             if (isset($frame['params']) && !isset($frame['args'])) {
                 $frame['args'] = $frame['params'];
             }
         }
         $ref = new \ReflectionProperty('Exception', 'trace');
         $ref->setAccessible(true);
         $ref->setValue($this, $trace);
     }
 }
开发者ID:sanggabee,项目名称:hellomedia-yii-basic,代码行数:35,代码来源:ErrorException.php

示例2: log

 /**
  * Logs a message.
  *
  * @param string Message
  * @param string Message priority
  * @param string Message priority name
  */
 public function log($message, $priority, $priorityName)
 {
     if (!sfConfig::get('sf_web_debug')) {
         return;
     }
     // if we have xdebug, add some stack information
     $debug_stack = array();
     if (function_exists('xdebug_get_function_stack')) {
         foreach (xdebug_get_function_stack() as $i => $stack) {
             if (isset($stack['function']) && !in_array($stack['function'], array('emerg', 'alert', 'crit', 'err', 'warning', 'notice', 'info', 'debug', 'log')) || !isset($stack['function'])) {
                 $tmp = '';
                 if (isset($stack['function'])) {
                     $tmp .= 'in "' . $stack['function'] . '" ';
                 }
                 $tmp .= 'from "' . $stack['file'] . '" line ' . $stack['line'];
                 $debug_stack[] = $tmp;
             }
         }
     }
     // get log type in {}
     $type = 'sfOther';
     if (preg_match('/^\\s*{([^}]+)}\\s*(.+?)$/', $message, $matches)) {
         $type = $matches[1];
         $message = $matches[2];
     }
     // build the object containing the complete log information.
     $logEntry = array('priority' => $priority, 'priorityString' => $priorityName, 'time' => time(), 'message' => $message, 'type' => $type, 'debugStack' => $debug_stack);
     // send the log object.
     $this->webDebug->log($logEntry);
 }
开发者ID:taryono,项目名称:school,代码行数:37,代码来源:sfWebDebugLogger.class.php

示例3: log

 /**
  * Logs a message.
  *
  * @param string Message
  * @param string Message priority
  * @param string Message priority name
  */
 public function log($message, $priority, $priorityName)
 {
     if (!sfConfig::get('sf_web_debug')) {
         return;
     }
     // if we have xdebug, add some stack information
     $debug_stack = array();
     // disable xdebug when an HTTP debug session exists (crashes Apache, see #2438)
     if (function_exists('xdebug_get_function_stack') && !isset($_GET['XDEBUG_SESSION_START']) && !isset($_COOKIE['XDEBUG_SESSION'])) {
         foreach (xdebug_get_function_stack() as $i => $stack) {
             if (isset($stack['function']) && !in_array($stack['function'], array('emerg', 'alert', 'crit', 'err', 'warning', 'notice', 'info', 'debug', 'log')) || !isset($stack['function'])) {
                 $tmp = '';
                 if (isset($stack['function'])) {
                     $tmp .= 'in "' . $stack['function'] . '" ';
                 }
                 $tmp .= 'from "' . $stack['file'] . '" line ' . $stack['line'];
                 $debug_stack[] = $tmp;
             }
         }
     }
     // get log type in {}
     $type = 'sfOther';
     if (preg_match('/^\\s*{([^}]+)}\\s*/', $message, $matches)) {
         $type = $matches[1];
         $message = preg_replace('/^(\\s*{' . $type . '}\\s*)/', '', $message);
     }
     // build the object containing the complete log information.
     $logEntry = array('priority' => $priority, 'priorityString' => $priorityName, 'time' => time(), 'message' => $message, 'type' => $type, 'debugStack' => $debug_stack);
     // send the log object.
     $this->webDebug->log($logEntry);
 }
开发者ID:Daniel-Marynicz,项目名称:symfony1-legacy,代码行数:38,代码来源:sfWebDebugLogger.class.php

示例4: response

 public static function response(Exception $e)
 {
     try {
         $class = get_class($e);
         $code = $e->getCode();
         $message = $e->getMessage();
         $file = $e->getFile();
         $line = $e->getLine();
         $trace = $e->getTrace();
         if ($e instanceof HTTP_Exception and $trace[0]["function"] == "factory") {
             extract(array_shift($trace));
         }
         if ($e instanceof ErrorException) {
             if (function_exists("xdebug_get_function_stack") and $code == E_ERROR) {
                 $trace = array_slice(array_reverse(xdebug_get_function_stack()), 4);
                 foreach ($trace as &$frame) {
                     /**
                      * XDebug pre 2.1.1 doesn"t currently set the call type key
                      * http://bugs.xdebug.org/view.php?id=695
                      */
                     if (!isset($frame["type"])) {
                         $frame["type"] = "??";
                     }
                     if ("dynamic" === $frame["type"]) {
                         $frame["type"] = "->";
                     } elseif ("static" === $frame["type"]) {
                         $frame["type"] = "::";
                     }
                     if (isset($frame["params"]) and !isset($frame["args"])) {
                         $frame["args"] = $frame["params"];
                     }
                 }
             }
             if (isset(JsonApiApplication_Exception::$php_errors[$code])) {
                 $code = JsonApiApplication_Exception::$php_errors[$code];
             }
         }
         /**
          * The stack trace becomes unmanageable inside PHPUnit.
          *
          * The error view ends up several GB in size, taking
          * serveral minutes to render.
          */
         if (defined("PHPUnit_MAIN_METHOD") or defined("PHPUNIT_COMPOSER_INSTALL") or defined("__PHPUNIT_PHAR__")) {
             $trace = array_slice($trace, 0, 2);
         }
         $view = View::factory(JsonApiApplication_Exception::$error_view, get_defined_vars());
         $response = Response::factory();
         $response->status($e instanceof HTTP_Exception ? $e->getCode() : 500);
         $response->headers("Content-Type", JsonApiApplication_Exception::$error_view_content_type . "; charset=" . JsonApiApplication::$charset);
         $response->body($view->render());
     } catch (Exception $e) {
         $response = Response::factory();
         $response->status(500);
         $response->headers("Content-Type", "text/plain");
         $response->body(JsonApiApplication_Exception::text($e));
     }
     return $response;
 }
开发者ID:benshez,项目名称:DreamWeddingCeremomies,代码行数:59,代码来源:Exception.php

示例5: __construct

 public function __construct($message, $code, $severity, $filename, $lineno, $traceOffset = null, $traceArgs = true, array $trace = null)
 {
     parent::__construct($message, $code, $severity, $filename, $lineno);
     if (null !== $trace) {
         if (!$traceArgs) {
             foreach ($trace as &$frame) {
                 unset($frame['args'], $frame['this'], $frame);
             }
         }
         $this->setTrace($trace);
     } elseif (null !== $traceOffset) {
         if (function_exists('xdebug_get_function_stack')) {
             $trace = xdebug_get_function_stack();
             if (0 < $traceOffset) {
                 array_splice($trace, -$traceOffset);
             }
             foreach ($trace as &$frame) {
                 if (!isset($frame['type'])) {
                     // XDebug pre 2.1.1 doesn't currently set the call type key http://bugs.xdebug.org/view.php?id=695
                     if (isset($frame['class'])) {
                         $frame['type'] = '::';
                     }
                 } elseif ('dynamic' === $frame['type']) {
                     $frame['type'] = '->';
                 } elseif ('static' === $frame['type']) {
                     $frame['type'] = '::';
                 }
                 // XDebug also has a different name for the parameters array
                 if (!$traceArgs) {
                     unset($frame['params'], $frame['args']);
                 } elseif (isset($frame['params']) && !isset($frame['args'])) {
                     $frame['args'] = $frame['params'];
                     unset($frame['params']);
                 }
             }
             unset($frame);
             $trace = array_reverse($trace);
         } elseif (function_exists('symfony_debug_backtrace')) {
             $trace = symfony_debug_backtrace();
             if (0 < $traceOffset) {
                 array_splice($trace, 0, $traceOffset);
             }
         } else {
             $trace = array();
         }
         $this->setTrace($trace);
     }
 }
开发者ID:sapwoo,项目名称:portfolio,代码行数:48,代码来源:FatalErrorException.php

示例6: fatal_handler

function fatal_handler()
{
    global $system_conf;
    $errfile = "unknown file";
    $errstr = "shutdown";
    $errno = E_CORE_ERROR;
    $errline = 0;
    $error = error_get_last();
    $stack = array();
    if (function_exists('xdebug_get_function_stack')) {
        foreach (array_slice(xdebug_get_function_stack(), 1, -1) as $row) {
            if (isset($row['class'])) {
                $row['type'] = isset($row['type']) && $row['type'] === 'dynamic' ? '->' : '::';
            }
            if (isset($row['params'])) {
                $row['args'] = $row['params'];
            }
            $stack[] = $row;
        }
    }
    if ($error !== NULL) {
        $errno = $error["type"];
        $errfile = $error["file"];
        $errline = $error["line"];
        $errstr = $error["message"];
    }
    global $phpminer_request_is_ajax, $phpminer_error_handler_messages;
    ErrorHandler::cc_error_handler($errno, $errstr, $errfile, $errline, "", true, $stack);
    $error = $phpminer_error_handler_messages;
    if (empty($error)) {
        return;
    }
    if ($phpminer_request_is_ajax) {
        $code = 560;
        $data = sys_get_temp_dir() . '/phpminer_' . uniqid() . '.bugreport';
        $return = array("code" => $code, "desc" => null, "data" => $data);
        if (is_array($error)) {
            $error = implode("\n", $error);
        }
        file_put_contents($data, "PHPMiner version: " . implode('.', $system_conf['version']) . "\n" . $error);
        echo json_encode($return);
        die;
    }
    echo implode("<br>", $error);
    die;
}
开发者ID:javascriptit,项目名称:phpminer,代码行数:46,代码来源:index.php

示例7: handleException

 /**
  * Formats and echoes the exception for the command line
  *
  * @param \Exception $exception The exception object
  * @return void
  */
 public function handleException(\Exception $exception)
 {
     $pathPosition = strpos($exception->getFile(), 'ext/');
     $filePathAndName = $pathPosition !== FALSE ? substr($exception->getFile(), $pathPosition) : $exception->getFile();
     $exceptionCodeNumber = $exception->getCode() > 0 ? '#' . $exception->getCode() . ': ' : '';
     echo PHP_EOL . 'Uncaught Exception in TYPO3 CMS ' . $exceptionCodeNumber . $exception->getMessage() . PHP_EOL;
     echo 'thrown in file ' . $filePathAndName . PHP_EOL;
     echo 'in line ' . $exception->getLine() . PHP_EOL;
     if ($exception instanceof \TYPO3\Flow\Exception) {
         echo 'Reference code: ' . $exception->getReferenceCode() . PHP_EOL;
     }
     $indent = '  ';
     while (($exception = $exception->getPrevious()) !== NULL) {
         echo PHP_EOL . $indent . 'Nested exception:' . PHP_EOL;
         $pathPosition = strpos($exception->getFile(), 'Packages/');
         $filePathAndName = $pathPosition !== FALSE ? substr($exception->getFile(), $pathPosition) : $exception->getFile();
         $exceptionCodeNumber = $exception->getCode() > 0 ? '#' . $exception->getCode() . ': ' : '';
         echo PHP_EOL . $indent . 'Uncaught Exception in Flow ' . $exceptionCodeNumber . $exception->getMessage() . PHP_EOL;
         echo $indent . 'thrown in file ' . $filePathAndName . PHP_EOL;
         echo $indent . 'in line ' . $exception->getLine() . PHP_EOL;
         if ($exception instanceof \TYPO3\Flow\Exception) {
             echo 'Reference code: ' . $exception->getReferenceCode() . PHP_EOL;
         }
         $indent .= '  ';
     }
     if (function_exists('xdebug_get_function_stack')) {
         $backtraceSteps = xdebug_get_function_stack();
     } else {
         $backtraceSteps = debug_backtrace();
     }
     for ($index = 0; $index < count($backtraceSteps); $index++) {
         echo PHP_EOL . '#' . $index . ' ';
         if (isset($backtraceSteps[$index]['class'])) {
             echo $backtraceSteps[$index]['class'];
         }
         if (isset($backtraceSteps[$index]['function'])) {
             echo '::' . $backtraceSteps[$index]['function'] . '()';
         }
         echo PHP_EOL;
         if (isset($backtraceSteps[$index]['file'])) {
             echo '   ' . $backtraceSteps[$index]['file'] . (isset($backtraceSteps[$index]['line']) ? ':' . $backtraceSteps[$index]['line'] : '') . PHP_EOL;
         }
     }
     echo PHP_EOL;
     exit(1);
 }
开发者ID:Outdoorsman,项目名称:typo3_console,代码行数:52,代码来源:ExceptionHandler.php

示例8: fixStack

 /** @internal */
 public static function fixStack($exception)
 {
     if (function_exists('xdebug_get_function_stack')) {
         $stack = array();
         foreach (array_slice(array_reverse(xdebug_get_function_stack()), 2, -1) as $row) {
             $frame = array('file' => $row['file'], 'line' => $row['line'], 'function' => isset($row['function']) ? $row['function'] : '*unknown*', 'args' => array());
             if (!empty($row['class'])) {
                 $frame['type'] = isset($row['type']) && $row['type'] === 'dynamic' ? '->' : '::';
                 $frame['class'] = $row['class'];
             }
             $stack[] = $frame;
         }
         $ref = new \ReflectionProperty('Exception', 'trace');
         $ref->setAccessible(TRUE);
         $ref->setValue($exception, $stack);
     }
     return $exception;
 }
开发者ID:VasekPurchart,项目名称:khanovaskola-v3,代码行数:19,代码来源:Helpers.php

示例9: storeCallerInfo

 protected function storeCallerInfo()
 {
     if (!function_exists('xdebug_get_function_stack')) {
         return;
     }
     ini_set('xdebug.collect_params', '1');
     $stack = xdebug_get_function_stack();
     ini_set('xdebug.collect_params', 0);
     if (count($stack) <= self::STACK_POSITION) {
         return;
     }
     $traceLine = $stack[count($stack) - self::STACK_POSITION];
     if (!isset($traceLine['file'])) {
         return;
     }
     $this->file = $traceLine['file'];
     $this->line = $traceLine['line'];
     $this->addMetaStep($traceLine, $stack);
 }
开发者ID:yurireeis,项目名称:CodeCeptionTest,代码行数:19,代码来源:Step.php

示例10: print_function_stack

 /**
  * Dump stack trace, only working when XDebug is present.
  *
  * @param string $message    The message to be logged
  * @param int $loglevel        The log level
  * @link http://www.xdebug.org/ xdebug.org
  */
 function print_function_stack($message, $loglevel = MIDCOM_LOG_DEBUG)
 {
     if (!$this->_enabled || $this->_loglevel < $loglevel) {
         return;
     }
     if (function_exists('xdebug_get_function_stack')) {
         $stack = array_reverse(xdebug_get_function_stack());
     } else {
         $stack = debug_backtrace(false);
     }
     //the last two levels are already inside the debugging system, so skip those
     array_shift($stack);
     array_shift($stack);
     $stacktrace = "";
     foreach ($stack as $number => $frame) {
         $stacktrace .= $number + 1;
         if (isset($frame['file'])) {
             $stacktrace .= ": {$frame['file']}:{$frame['line']} ";
         }
         if (array_key_exists('class', $frame)) {
             $stacktrace .= "{$frame['class']}::{$frame['function']}";
         } else {
             if (array_key_exists('function', $frame)) {
                 $stacktrace .= $frame['function'];
             } else {
                 $stacktrace .= 'require, include or eval';
             }
         }
         $stacktrace .= "\n";
     }
     unset($stack);
     $this->log(trim($message) . "\n{$stacktrace}", $loglevel);
 }
开发者ID:nemein,项目名称:openpsa,代码行数:40,代码来源:debug.php

示例11: error

 public static function error(Exception $e, $sql, $params = array(), $shardID = 0)
 {
     $paramsArray = Z_Array::array2string($params);
     $error = $e->getMessage();
     $errno = $e->getCode();
     $str = "{$error}\n\n" . "Shard: {$shardID}\n\n" . "Query:\n{$sql}\n\n" . "Params:\n{$paramsArray}\n\n";
     if (function_exists('xdebug_get_function_stack')) {
         $str .= Z_Array::array2string(xdebug_get_function_stack());
     }
     if (strpos($error, "Can't connect to MySQL server") !== false) {
         throw new Exception($str, Z_ERROR_SHARD_UNAVAILABLE);
     }
     throw new Exception($str, $errno);
 }
开发者ID:robinpaulson,项目名称:dataserver,代码行数:14,代码来源:DB.inc.php

示例12: _setTightness

 function _setTightness($top, $bot)
 {
     if (count($this->_content) == 1) {
         $li =& $this->_content[0];
         $li->setTightness($top, $bot);
     } else {
         // This is where php5 usually brakes.
         // wrong duplicated <li> contents
         if (DEBUG and DEBUG & _DEBUG_PARSER and check_php_version(5)) {
             if (count($this->_content) != 2) {
                 echo "<pre>";
                 /*
                 $class = new Reflection_Class('XmlElement');
                 // Print out basic information
                 printf(
                        "===> The %s%s%s %s '%s' [extends %s]\n".
                        "     declared in %s\n".
                        "     lines %d to %d\n".
                        "     having the modifiers %d [%s]\n",
                        $class->isInternal() ? 'internal' : 'user-defined',
                        $class->isAbstract() ? ' abstract' : '',
                        $class->isFinal() ? ' final' : '',
                        $class->isInterface() ? 'interface' : 'class',
                        $class->getName(),
                        var_export($class->getParentClass(), 1),
                        $class->getFileName(),
                        $class->getStartLine(),
                        $class->getEndline(),
                        $class->getModifiers(),
                        implode(' ', Reflection::getModifierNames($class->getModifiers()))
                        );
                 // Print class properties
                 printf("---> Properties: %s\n", var_export($class->getProperties(), 1));
                 */
                 echo 'count($this->_content): ', count($this->_content), "\n";
                 echo "\$this->_content[0]: ";
                 var_dump($this->_content[0]);
                 for ($i = 1; $i < min(5, count($this->_content)); $i++) {
                     $c =& $this->_content[$i];
                     echo '$this->_content[', $i, "]: \n";
                     echo "_tag: ";
                     var_dump($c->_tag);
                     echo "_content: ";
                     var_dump($c->_content);
                     echo "_properties: ";
                     var_dump($c->_properties);
                 }
                 debug_print_backtrace();
                 if (DEBUG & _DEBUG_APD) {
                     if (function_exists("xdebug_get_function_stack")) {
                         var_dump(xdebug_get_function_stack());
                     }
                 }
                 echo "</pre>";
             }
         }
         if (!check_php_version(5)) {
             assert(count($this->_content) == 2);
         }
         $dt =& $this->_content[0];
         $dd =& $this->_content[1];
         $dt->setTightness($top, false);
         $dd->setTightness(false, $bot);
     }
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:65,代码来源:BlockParser.php

示例13: getXDebugStack

  /**
   * Returns the xdebug stack.
   *
   * @return array The xdebug stack as an array
   *
   * @deprecated Use {@link getDebugBacktrace()} instead. Will be removed in symfony 1.4.
   */
  protected function getXDebugStack()
  {
    // if we have xdebug and dev has not disabled the feature, add some stack information
    if (!$this->xdebugLogging || !function_exists('xdebug_get_function_stack'))
    {
      return array();
    }

    $debugStack = array();
    foreach (xdebug_get_function_stack() as $i => $stack)
    {
      if (
        (isset($stack['function']) && !in_array($stack['function'], array('emerg', 'alert', 'crit', 'err', 'warning', 'notice', 'info', 'debug', 'log')))
        || !isset($stack['function'])
      )
      {
        $tmp = '';
        if (isset($stack['function']))
        {
          $tmp .= sprintf('in "%s" ', $stack['function']);
        }
        $tmp .= sprintf('from "%s" line %s', $stack['file'], $stack['line']);
        $debugStack[] = $tmp;
      }
    }

    return $debugStack;
  }
开发者ID:nationalfield,项目名称:symfony,代码行数:35,代码来源:sfVarLogger.class.php

示例14: doLog

 /**
  * Logs a message.
  *
  * @param string $message   Message
  * @param string $priority  Message priority
  */
 protected function doLog($message, $priority)
 {
     // if we have xdebug and dev has not disabled the feature, add some stack information
     $debugStack = array();
     if ($this->xdebugLogging && function_exists('xdebug_get_function_stack')) {
         foreach (xdebug_get_function_stack() as $i => $stack) {
             if (isset($stack['function']) && !in_array($stack['function'], array('emerg', 'alert', 'crit', 'err', 'warning', 'notice', 'info', 'debug', 'log')) || !isset($stack['function'])) {
                 $tmp = '';
                 if (isset($stack['function'])) {
                     $tmp .= sprintf('in "%s" ', $stack['function']);
                 }
                 $tmp .= sprintf('from "%s" line %s', $stack['file'], $stack['line']);
                 $debugStack[] = $tmp;
             }
         }
     }
     // get log type in {}
     $type = 'sfOther';
     if (preg_match('/^\\s*{([^}]+)}\\s*(.+?)$/', $message, $matches)) {
         $type = $matches[1];
         $message = $matches[2];
     }
     // send the log object containing the complete log information
     $this->webDebug->log(array('priority' => $priority, 'time' => time(), 'message' => $message, 'type' => $type, 'debugStack' => $debugStack));
 }
开发者ID:ajith24,项目名称:ajithworld,代码行数:31,代码来源:sfWebDebugLogger.class.php

示例15: showCallStack

 public static function showCallStack()
 {
     echo 'CallStack - File: ' . xdebug_call_file();
     echo '<br />Class: ' . xdebug_call_class();
     echo '<br />Function: ' . xdebug_call_function();
     echo '<br />Line: ' . xdebug_call_line();
     echo '<br />Depth of Stacks: ' . xdebug_get_stack_depth();
     echo '<br />Content of Stack: ' . xdebug_var_dump(xdebug_get_function_stack());
 }
开发者ID:ksst,项目名称:kf,代码行数:9,代码来源:XDebug.php


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