Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gather and imploade $_GET request to load tracy_bar JS content #352

Closed
nemethit opened this issue Mar 5, 2019 · 1 comment
Closed

Gather and imploade $_GET request to load tracy_bar JS content #352

nemethit opened this issue Mar 5, 2019 · 1 comment

Comments

@nemethit
Copy link

@nemethit nemethit commented Mar 5, 2019

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

  1. Additional function in constructor to get all non-tracy-specfic $_GET propertys and values.
  2. 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&amp;v=<?= urlencode(Debugger::VERSION) ?>&amp;XDEBUG_SESSION_STOP=1" data-id="<?= Helpers::escapeHtml($contentId) ?>"<?= $nonceAttr ?>></script>
dg added a commit that referenced this issue Mar 5, 2019
dg added a commit that referenced this issue Mar 5, 2019
@dg

This comment has been minimized.

Copy link
Member

@dg dg commented Mar 5, 2019

fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.