Ejemplo n.º 1
0
 function jTraceEx($e, $seen = null)
 {
     $result = array();
     $seen = !$seen ? array() : array();
     $trace = $e->getTrace();
     $prev = $e->getPrevious();
     $file = $e->getFile();
     $line = $e->getLine();
     $result[] = sprintf('%s: %s', get_class($e), $e->getMessage() . " (" . $this->getCode() . ")");
     while (true) {
         $current = "{$file}:{$line}";
         if (is_array($seen) && in_array($current, $seen)) {
             $result[] = sprintf('   ... %d more', count($trace) + 1);
             break;
         }
         $result[] = sprintf('   at %s%s%s(%s%s%s)', count($trace) && array_key_exists('class', $trace[0]) ? str_replace('\\', '.', $trace[0]['class']) : '', count($trace) && array_key_exists('class', $trace[0]) && array_key_exists('function', $trace[0]) ? '.' : '', count($trace) && array_key_exists('function', $trace[0]) ? str_replace('\\', '.', $trace[0]['function']) : '(main)', str_replace(ALT_PATH, '', $file), $line === null ? '' : ':', $line === null ? '' : $line);
         if (is_array($seen)) {
             $seen[] = "{$file}:{$line}";
         }
         if (!count($trace)) {
             break;
         }
         $file = array_key_exists('file', $trace[0]) ? $trace[0]['file'] : 'Unknown Source';
         $line = array_key_exists('file', $trace[0]) && array_key_exists('line', $trace[0]) && $trace[0]['line'] ? $trace[0]['line'] : null;
         array_shift($trace);
     }
     $result = join("\n", $result);
     if ($prev) {
         $result .= "\n" . jTraceEx($prev, $seen);
     }
     return $result;
 }
Ejemplo n.º 2
0
<?php

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
//require "../vendor/autoloader.php";
//use Slim\Slim;
//$app = new Slim();
//require "../app/routes.php";
//$app->run();
require_once "../app/jTraceEx.php";
require_once "../app/loader.php";
use App\Router\Router;
try {
    require_once "../app/config.php";
    require_once "../app/routes.php";
    Router::serve();
} catch (\Exception $e) {
    echo "<pre>" . jTraceEx($e) . "</pre>";
}