-
-
Notifications
You must be signed in to change notification settings - Fork 218
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BlueScreen: displays real arguments and local variables using xdebug …
…[WIP] - requires xdebug 3.3 and xdebug.mode=develop - stores information only for the last 8 exceptions, so we don't want to generate new exceptions during rendering
- Loading branch information
Showing
7 changed files
with
162 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
require __DIR__ . '/../src/tracy.php'; | ||
|
||
use Tracy\Debugger; | ||
|
||
// For security reasons, Tracy is visible only on localhost. | ||
// You may force Tracy to run in development mode by passing the Debugger::Development instead of Debugger::Detect. | ||
//Debugger::$strictMode = true; | ||
Debugger::enable(Debugger::Detect, __DIR__ . '/log'); | ||
|
||
?> | ||
<!DOCTYPE html><link rel="stylesheet" href="assets/style.css"> | ||
|
||
<h1>Tracy: exception demo</h1> | ||
|
||
<?php | ||
|
||
class DemoClass | ||
{ | ||
public function first($arg1, $arg2) | ||
{ | ||
$arg1 = 'new'; | ||
$arg3 = 'xxx'; | ||
$this->second(); | ||
} | ||
|
||
|
||
public function second() | ||
{ | ||
self::third([1, 2, 3]); | ||
} | ||
|
||
|
||
public static function third($arg5) | ||
{ | ||
//require __DIR__ . '/assets/E_COMPILE_WARNING-1.php'; | ||
//require __DIR__ . '/assets/E_COMPILE_ERROR.php'; | ||
// trigger_error('jo', E_USER_ERROR); | ||
// dump(new Exception); | ||
// dumpe(xdebug_get_function_stack( [ 'local_vars' => true, 'params_as_values' => true ] )); | ||
try { | ||
throw new Exception('Original'); | ||
} catch (Exception $e) { | ||
throw new Exception('The my exception', 123, $e); | ||
} | ||
$a++; | ||
} | ||
} | ||
|
||
|
||
|
||
function demo($a, $b) | ||
{ | ||
$demo = new DemoClass; | ||
$demo->first($a, $b); | ||
} | ||
|
||
|
||
if (Debugger::$productionMode) { | ||
echo '<p><b>For security reasons, Tracy is visible only on localhost. Look into the source code to see how to enable Tracy.</b></p>'; | ||
} | ||
|
||
demo(10, 'any string'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Tracy; | ||
|
||
/** | ||
* @var ?array $variables | ||
*/ | ||
|
||
if (empty($variables[-1])) { | ||
return; | ||
} | ||
?> | ||
|
||
<section class="tracy-section"> | ||
<h2 class="tracy-section-label"><a href="#" data-tracy-ref="^+" class="tracy-toggle tracy-collapsed">Local variables</a></h2> | ||
|
||
<div class="tracy-section-panel tracy-collapsed"> | ||
<table class="tracy-callstack-args"> | ||
<?php | ||
foreach ($variables[-1] as $k => $v) { | ||
echo '<tr><th>$', Helpers::escapeHtml($k), '</th><td>'; | ||
echo $dump($v, $k); | ||
echo "</td></tr>\n"; | ||
} | ||
?> | ||
</table> | ||
</div> | ||
</section> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters