-
-
Notifications
You must be signed in to change notification settings - Fork 221
Description
Version: 2.5.5
Bug Description
In my environment Tracy only changes into the development-mode, when running in the test-environment or a specific get-parameter with value is given.
The issue here isn't that tracy doesn't starts, but that the JS file which is necessary to init tracy_bar doesn't get loaded, because the target JS file seems empty.
https://domain.tld?_tracy_bar=js&v=2.5.4&XDEBUG_SESSION_STOP=1
The reason behind that is that Tracy doesn't know that it can also be toggled into development-mode by a specific GET-parameter. Why the JS file should be load with the user-specific GET-parameters, like:
https://domain.tld?dump&_tracy_bar=js&v=2.5.4&XDEBUG_SESSION_STOP=1
Steps To Reproduce
Put Tracy declaration and initialization behind a $_GET condition, it will cause Tracy to load the dump-results for the bar, but not load the JS-script which is necessary to start the whole tracy_bar.
Hint: In my cases the dump/debug-parameter requires a dynamic-hash value, but for better understanding I've made this example just with an simple isset().
use Tracy\Debugger;
# Initial DEVELOPMENT declaration
$debugStatus = 'enable';
$debugMode = Debugger::PRODUCTION;
$logDirectory = __DIR__ . "/../../../log/$environmentScopeName";
# Conditional DEVELOPMENT declaration
if( isTestEnvironment() || isset($_GET['dump']) ) {
$debugStatus = 'enable';
$debugMode = Debugger::DEVELOPMENT;
Debugger::$strictMode = true;
}
# Traycy Debugger Configuration
Debugger::$maxDepth = 0; // default: 3
Debugger::$maxLength = 10240; // default: 150
. . .
Debugger::$logSeverity = E_ALL | E_NOTICE | E_WARNING;
# Start Tracy
Debugger::$debugStatus($debugMode, $logDirectory);Expected Behavior
Detecting non-tracy get-parameters and including them into url to load the tracy_bar JS content.
Possible Solution
- Additional function in constructor to get all non-tracy-specfic $_GET propertys and values.
- Another function to implode them into url when loading tracy_bar JS.
Something like <?= implode_user_specific_get() ?> in /vendor/tracy/tracy/src/Tracy/assets/Bar/loader.phtml:
<script src="<?= Helpers::escapeHtml($baseUrl) ?>?<?= implode_user_specific_get() ?>_tracy_bar=js&v=<?= urlencode(Debugger::VERSION) ?>&XDEBUG_SESSION_STOP=1" data-id="<?= Helpers::escapeHtml($contentId) ?>"<?= $nonceAttr ?>></script>