-
-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BlueScreen: added panels for Generator & Fiber
- Loading branch information
Showing
18 changed files
with
662 additions
and
28 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
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,38 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Tracy; | ||
|
||
/** | ||
* @var \Throwable $ex | ||
* @var callable $dump | ||
* @var BlueScreen $this | ||
*/ | ||
|
||
$stack = $ex->getTrace(); | ||
$expanded = null; | ||
if ( | ||
(!$ex instanceof \ErrorException | ||
|| in_array($ex->getSeverity(), [E_USER_NOTICE, E_USER_WARNING, E_USER_DEPRECATED], true)) | ||
&& $this->isCollapsed($ex->getFile()) | ||
) { | ||
foreach ($stack as $key => $row) { | ||
if (isset($row['file']) && !$this->isCollapsed($row['file'])) { | ||
$expanded = $key; | ||
break; | ||
} | ||
} | ||
} | ||
|
||
if (in_array($stack[0]['class'] ?? null, [DevelopmentStrategy::class, ProductionStrategy::class], true)) { | ||
array_shift($stack); | ||
} | ||
if (($stack[0]['class'] ?? null) === Debugger::class && in_array($stack[0]['function'], ['shutdownHandler', 'errorHandler'], true)) { | ||
array_shift($stack); | ||
} | ||
$file = $ex->getFile(); | ||
$line = $ex->getLine(); | ||
|
||
require __DIR__ . '/section-stack-sourceFile.phtml'; | ||
require __DIR__ . '/section-stack-callStack.phtml'; |
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,16 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Tracy; | ||
|
||
/** | ||
* @var \Fiber $fiber | ||
* @var callable $dump | ||
*/ | ||
|
||
$ref = new \ReflectionFiber($fiber); | ||
$stack = $ref->getTrace(); | ||
$expanded = 0; | ||
|
||
require __DIR__ . '/section-stack-callStack.phtml'; |
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,21 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Tracy; | ||
|
||
/** | ||
* @var \Generator $generator | ||
* @var callable $dump | ||
*/ | ||
|
||
$ref = new \ReflectionGenerator($generator); | ||
$stack = $ref->getTrace(); | ||
$expanded = null; | ||
$execGenerator = $ref->getExecutingGenerator(); | ||
$refExec = new \ReflectionGenerator($execGenerator); | ||
$file = $refExec->getExecutingFile(); | ||
$line = $refExec->getExecutingLine(); | ||
|
||
require __DIR__ . '/section-stack-sourceFile.phtml'; | ||
require __DIR__ . '/section-stack-callStack.phtml'; |
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,62 @@ | ||
<?php | ||
|
||
/** | ||
* Test: Tracy\Debugger exception in HTML. | ||
* @phpVersion 8.1 | ||
* @httpCode 500 | ||
* @exitCode 255 | ||
* @outputMatchFile expected/Debugger.exception.fiber.html.expect | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
use Tracy\Debugger; | ||
|
||
require __DIR__ . '/../bootstrap.php'; | ||
|
||
if (PHP_SAPI === 'cli') { | ||
Tester\Environment::skip('Debugger Bluescreen is not rendered in CLI mode'); | ||
} | ||
|
||
|
||
Debugger::$productionMode = false; | ||
setHtmlMode(); | ||
|
||
Debugger::enable(); | ||
|
||
|
||
function gen1() | ||
{ | ||
gen2(123); | ||
} | ||
|
||
|
||
function gen2($a) | ||
{ | ||
$x = Fiber::suspend($a); | ||
} | ||
|
||
|
||
function first($arg1, $arg2) | ||
{ | ||
second(true, false); | ||
} | ||
|
||
|
||
function second($arg1, $arg2) | ||
{ | ||
third([1, 2, 3]); | ||
} | ||
|
||
|
||
function third($arg1) | ||
{ | ||
throw new Exception('The my exception', 123); | ||
} | ||
|
||
|
||
$fiber = new Fiber(function () { | ||
gen1(); | ||
}); | ||
$fiber->start(); | ||
first($fiber, 'any string'); |
Oops, something went wrong.