Skip to content

Commit

Permalink
Dumper: fixed missing escape for & (#187)
Browse files Browse the repository at this point in the history
  • Loading branch information
JanTvrdik authored and dg committed May 21, 2016
1 parent 01cfbcc commit b4ecf43
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Tracy/Dumper.php
Expand Up @@ -111,7 +111,7 @@ public static function toHtml($var, array $options = NULL)

return '<pre class="tracy-dump' . ($live && $options[self::COLLAPSE] === TRUE ? ' tracy-collapsed' : '') . '"'
. $locAttrs
. ($live ? " data-tracy-dump='" . str_replace("'", '&#039;', json_encode(self::toJson($var, $options))) . "'>" : '>')
. ($live ? " data-tracy-dump='" . json_encode(self::toJson($var, $options), JSON_HEX_APOS | JSON_HEX_AMP) . "'>" : '>')
. ($live ? '' : self::dumpVar($var, $options))
. ($file && $loc & self::LOCATION_LINK ? '<small>in ' . Helpers::editorLink($file, $line) . '</small>' : '')
. "</pre>\n";
Expand Down
4 changes: 2 additions & 2 deletions tests/Tracy/Dumper.toHtml().live.phpt
Expand Up @@ -33,8 +33,8 @@ Assert::match('<pre class="tracy-dump"><span class="tracy-dump-number">0</span>
</pre>', Dumper::toHtml(0, $options));

Assert::match(
'<pre class="tracy-dump" data-tracy-dump=\'[[0,null],[1,true],[2,false],[3,0],[4,{"number":"0.0"}],[5,"string"],[6,"\\\\x00"],[7,{"type":"INF"}],[8,{"type":"-INF"}],[9,{"type":"NAN"}]]\'></pre>',
Dumper::toHtml([NULL, TRUE, FALSE, 0, 0.0, 'string', "\x00", INF, -INF, NAN], $options)
'<pre class="tracy-dump" data-tracy-dump=\'[[0,null],[1,true],[2,false],[3,0],[4,{"number":"0.0"}],[5,"string"],[6,"\u0027\u0026\""],[7,"\\\\x00"],[8,{"type":"INF"}],[9,{"type":"-INF"}],[10,{"type":"NAN"}]]\'></pre>',
Dumper::toHtml([NULL, TRUE, FALSE, 0, 0.0, 'string', "'&\"", "\x00", INF, -INF, NAN], $options)
);

Assert::match('<pre class="tracy-dump"><span class="tracy-dump-array">array</span> ()
Expand Down

0 comments on commit b4ecf43

Please sign in to comment.