Permalink
Browse files

removed support for PHP 5.3

  • Loading branch information...
dg committed May 20, 2015
1 parent 474bd6c commit 713a85ba423d6d260406c0e4b869bbfaf8c924e6
@@ -131,7 +131,7 @@ class Debugger
public static function enable($mode = NULL, $logDirectory = NULL, $email = NULL)
{
self::$time = isset($_SERVER['REQUEST_TIME_FLOAT']) ? $_SERVER['REQUEST_TIME_FLOAT'] : microtime(TRUE);
error_reporting(E_ALL | E_STRICT);
error_reporting(E_ALL);
if ($mode !== NULL || self::$productionMode === NULL) {
self::$productionMode = is_bool($mode) ? $mode : !self::detectDebugMode($mode);
@@ -289,11 +289,11 @@ public static function exceptionHandler(\Exception $exception, $exit = TRUE)
public static function errorHandler($severity, $message, $file, $line, $context)
{
if (self::$scream) {
error_reporting(E_ALL | E_STRICT);
error_reporting(E_ALL);
}
if ($severity === E_RECOVERABLE_ERROR || $severity === E_USER_ERROR) {
if (Helpers::findTrace(debug_backtrace(PHP_VERSION_ID >= 50306 ? DEBUG_BACKTRACE_IGNORE_ARGS : FALSE), '*::__toString')) {
if (Helpers::findTrace(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS), '*::__toString')) {
$previous = isset($context['e']) && $context['e'] instanceof \Exception ? $context['e'] : NULL;
$e = new ErrorException($message, 0, $severity, $file, $line, $previous);
$e->context = $context;
@@ -26,9 +26,9 @@ class Dumper
LIVE = 'live'; // will be rendered using JavaScript
const
LOCATION_SOURCE = 1, // shows where dump was called
LOCATION_LINK = 2, // appends clickable anchor
LOCATION_CLASS = 4; // shows where class is defined
LOCATION_SOURCE = 0b0001, // shows where dump was called
LOCATION_LINK = 0b0010, // appends clickable anchor
LOCATION_CLASS = 0b0100; // shows where class is defined
/** @var array */
public static $terminalColors = [
@@ -128,7 +128,7 @@ public static function toText($var, array $options = NULL)
public static function toTerminal($var, array $options = NULL)
{
return htmlspecialchars_decode(strip_tags(preg_replace_callback('#<span class="tracy-dump-(\w+)">|</span>#', function($m) {
return "\033[" . (isset($m[1], Dumper::$terminalColors[$m[1]]) ? Dumper::$terminalColors[$m[1]] : '0') . 'm';
return "\033[" . (isset($m[1], self::$terminalColors[$m[1]]) ? self::$terminalColors[$m[1]] : '0') . 'm';
}, self::toHtml($var, $options))), ENT_QUOTES);
}
@@ -498,7 +498,7 @@ private static function exportPhpIncompleteClass(\__PHP_Incomplete_Class $obj)
*/
private static function findLocation()
{
foreach (debug_backtrace(PHP_VERSION_ID >= 50306 ? DEBUG_BACKTRACE_IGNORE_ARGS : FALSE) as $item) {
foreach (debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS) as $item) {
if (isset($item['class']) && $item['class'] === __CLASS__) {
$location = $item;
continue;
@@ -110,11 +110,7 @@ public static function fixStack($exception)
/** @internal */
public static function fixEncoding($s)
{
if (PHP_VERSION_ID < 50400) {
return @iconv('UTF-16', 'UTF-8//IGNORE', iconv('UTF-8', 'UTF-16//IGNORE', $s)); // intentionally @
} else {
return htmlspecialchars_decode(htmlspecialchars($s, ENT_NOQUOTES | ENT_IGNORE, 'UTF-8'), ENT_NOQUOTES);
}
return htmlspecialchars_decode(htmlspecialchars($s, ENT_NOQUOTES | ENT_IGNORE, 'UTF-8'), ENT_NOQUOTES);
}
@@ -35,14 +35,14 @@ public function start()
$this->list[] = [$file, 1, self::BOM];
}
}
ob_start([$this, 'handler'], PHP_VERSION_ID >= 50400 ? 1 : 2);
ob_start([$this, 'handler'], 1);
}
/** @internal */
public function handler($s, $phase)
{
$trace = debug_backtrace(PHP_VERSION_ID >= 50306 ? DEBUG_BACKTRACE_IGNORE_ARGS : FALSE);
$trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
if (isset($trace[0]['file'], $trace[0]['line'])) {
$stack = $trace;
unset($stack[0]['line'], $stack[0]['args']);
@@ -12,11 +12,11 @@ namespace Tracy;
use Tracy;
$info = array_filter([
'Execution time' => str_replace(' ', '', number_format($this->time * 1000, 1, '.', ' ')) . ' ms',
'Peak of allocated memory' => str_replace(' ', '', number_format(memory_get_peak_usage() / 1000000, 2, '.', ' ')) . ' MB',
'Execution time' => number_format($this->time * 1000, 1, '.', '') . ' ms',
'Peak of allocated memory' => number_format(memory_get_peak_usage() / 1000000, 2, '.', '') . ' MB',
'Included files' => count(get_included_files()),
'Classes + interfaces + traits' => count(get_declared_classes()) . ' + '
. count(get_declared_interfaces()) . ' + ' . (PHP_VERSION_ID >= 50400 ? count(get_declared_traits()) : '0'),
. count(get_declared_interfaces()) . ' + ' . count(get_declared_traits()),
'Your IP' => isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : NULL,
'Server IP' => isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : NULL,
'HHVM' => defined('HHVM_VERSION') ? HHVM_VERSION : NULL,
@@ -16,5 +16,5 @@ $this->time = microtime(TRUE) - Debugger::$time;
?>
<span title="Execution time">
<svg viewBox="0 0 2048 2048"><path fill="#86bbf0" d="m640 1153.6v639.3h-256v-639.3z"/><path fill="#6ba9e6" d="m1024 254.68v1538.2h-256v-1538.2z"/><path fill="#4f96dc" d="m1408 897.57v894.3h-256v-894.3z"/><path fill="#3987d4" d="m1792 513.08v1279.8h-256v-1279.8z"/>
</svg><span class="tracy-label"><?= str_replace(' ', '', number_format($this->time * 1000, 1, '.', ' ')) ?> ms</span>
</svg><span class="tracy-label"><?= number_format($this->time * 1000, 1, '.', '') ?> ms</span>
</span>

0 comments on commit 713a85b

Please sign in to comment.