Skip to content

Incorrect barDump escaping in lazy mode #421

@schlndh

Description

@schlndh

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions