[VarDumper] Fix uninitialized id in HtmlDumper

This commit is contained in:
Nicolas Grekas 2015-06-17 15:18:54 +02:00
parent da662497f0
commit 00eee72f0e

View File

@ -46,6 +46,15 @@ class HtmlDumper extends CliDumper
'index' => 'color:#1299DA',
);
/**
* {@inheritdoc}
*/
public function __construct($output = null, $charset = null)
{
parent::__construct($output, $charset);
$this->dumpId = 'sf-dump-'.mt_rand();
}
/**
* {@inheritdoc}
*/
@ -94,8 +103,8 @@ class HtmlDumper extends CliDumper
*/
public function dump(Data $data, $output = null)
{
$this->dumpId = 'sf-dump-'.mt_rand();
parent::dump($data, $output);
$this->dumpId = 'sf-dump-'.mt_rand();
}
/**
@ -342,7 +351,7 @@ EOHTML;
$style .= sprintf(' title="%s%s characters"', $attr['length'], $attr['binary'] ? ' binary or non-UTF-8' : '');
} elseif ('note' === $style) {
if (false !== $c = strrpos($v, '\\')) {
return sprintf('<abbr title="%s" class=sf-dump-%s>%s</abbr>', $v, $style, substr($v, $c+1));
return sprintf('<abbr title="%s" class=sf-dump-%s>%s</abbr>', $v, $style, substr($v, $c + 1));
} elseif (':' === $v[0]) {
return sprintf('<abbr title="`%s` resource" class=sf-dump-%s>%s</abbr>', substr($v, 1), $style, $v);
}