コード例 #1
0
    private function build_stack_trace()
    {
        $i = 0;
        $this->is_row_odd = true;
        $stack = '';
        foreach ($this->exception->getTrace() as $call) {
            $row_class = $this->is_row_odd ? 'oddRow' : 'evenRow';
            $has_args = ExceptionUtils::has_args($call);
            $id = 'call' . $i . 'Arguments';
            $stack .= '<tr class="' . $row_class . '">';
            $stack .= '<td class="args">';
            if ($has_args) {
                $stack .= '<a href="javascript:toggleDisplay(this, \'' . $id . '\');">+</a>';
            }
            $stack .= '</td>';
            $stack .= '<td class="prototype">' . ExceptionUtils::get_method_prototype($call) . '</td>';
            $stack .= '<td class="file">' . ExceptionUtils::get_file($call) . '</td>';
            $stack .= '<td class="line">' . ExceptionUtils::get_line($call) . '</td>';
            $stack .= '</tr>';
            if ($has_args) {
                $stack .= '<tr id="' . $id . '" style="display:none;" class="' . $row_class . '">
				<td colspan="4" class="argsDetails">' . ExceptionUtils::get_args($call) . '</td></tr>';
            }
            $i++;
            $this->is_row_odd = !$this->is_row_odd;
        }
        return $stack;
    }
コード例 #2
0
ファイル: Debug.class.php プロジェクト: AroundPBT/PHPBoost
 /**
  * @desc print the current stacktrace
  */
 public static function get_stacktrace_as_string($start_trace_index = 0, Exception $exception = null)
 {
     $string_stacktrace = '';
     $stacktrace = null;
     if ($exception === null) {
         $stacktrace = self::get_stacktrace();
     } else {
         $start_trace_index--;
         $stacktrace = $exception->getTrace();
     }
     $stacktrace_size = count($stacktrace);
     $start_trace_index = $start_trace_index + 1;
     for ($i = $start_trace_index; $i < $stacktrace_size; $i++) {
         $trace =& $stacktrace[$i];
         $string_stacktrace .= '[' . ($i - $start_trace_index) . '] ' . ExceptionUtils::get_file($trace) . ':' . ExceptionUtils::get_line($trace) . ' - ' . ExceptionUtils::get_method_prototype($trace) . "\n";
     }
     $string_stacktrace .= '[URL] ' . $_SERVER['REQUEST_URI'];
     if (self::is_output_html()) {
         $string_stacktrace = str_replace("\n", '<br />', $string_stacktrace);
     }
     return $string_stacktrace;
 }