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

Incorrect barDump escaping in lazy mode #421

Closed
schlndh opened this issue May 16, 2020 · 1 comment
Closed

Incorrect barDump escaping in lazy mode #421

schlndh opened this issue May 16, 2020 · 1 comment

Comments

@schlndh
Copy link

@schlndh schlndh commented May 16, 2020

Version: 2.7.4

Bug Description

BarDump is not correctly escaped in lazy mode, which can occasionally lead to Tracy Bar not being displayed at all, because the Tracy.Debug.Init call is not parsed correctly. The issue happens in both Chrome and Firefox. There are no JS errors in console when that happens and pasting the generated Tracy.Debug.Init call into browser console makes the bar show up normally.

Steps To Reproduce

<?php

use Tracy\Debugger;

require_once __DIR__ . '/vendor/autoload.php';

Debugger::enable(Debugger::DEVELOPMENT);

$a = (object) [
    'a' => '<!--<script>',
];

Debugger::barDump($a, 'a');
// this works
//Debugger::barDump($a, 'a', [\Tracy\Dumper::LAZY => false]);
//Debugger::barDump($a->a, 'a');

It generates a call like this (shortened):

<script>
Tracy.Debug.init("... data-tracy-snapshot=&#039;{\"1\":{\"name\":\"stdClass\",\"hash\":\"520b\",\"items\":[[\"a\",\"<!--<script>\",0]]}}&#039; ...");
</script>

Expected Behavior

The bar should show up as usual and contain the same dump as without the lazy mode.

dg added a commit that referenced this issue May 16, 2020
dg added a commit that referenced this issue May 16, 2020
dg added a commit that referenced this issue May 16, 2020
@dg
Copy link
Member

@dg dg commented May 16, 2020

Fixed

@dg dg closed this as completed May 16, 2020
dg added a commit that referenced this issue May 16, 2020
dg added a commit that referenced this issue May 17, 2020
dg added a commit that referenced this issue May 17, 2020
dg added a commit that referenced this issue May 17, 2020
dg added a commit that referenced this issue May 17, 2020
dg added a commit that referenced this issue May 17, 2020
dg added a commit that referenced this issue May 17, 2020
dg added a commit that referenced this issue May 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants