Skip to content

Commit

Permalink
[VarDumper] Use Unicode Control Pictures
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-grekas committed Nov 6, 2014
1 parent f1c34f9 commit cd076e4
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
1 change: 0 additions & 1 deletion src/Symfony/Component/VarDumper/Cloner/AbstractCloner.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ abstract class AbstractCloner implements ClonerInterface
protected $maxString = -1;

private $casters = array();
private $data = array(array(null));
private $prevErrorHandler;
private $classInfo = array();

Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/VarDumper/Dumper/CliDumper.php
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ protected function dumpKey(Cursor $cursor)
}

if ($cursor->hardRefTo) {
$this->line .= $this->style('ref', '&'.$cursor->hardRefTo, array('count' => $cursor->hardRefCount)).' ';
$this->line .= $this->style('ref', '&'.($cursor->hardRefCount ? $cursor->hardRefTo : ''), array('count' => $cursor->hardRefCount)).' ';
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class HtmlDumper extends CliDumper
'num' => 'font-weight:bold; color:#1299DA',
'const' => 'font-weight:bold',
'str' => 'font-weight:bold; color:#56DB3A',
'cchr' => 'font-style:italic',
'cchr' => 'color:#FF8400',
'note' => 'color:#1299DA',
'ref' => 'color:#A0A0A0',
'public' => 'color:#FFFFFF',
Expand Down Expand Up @@ -319,7 +319,8 @@ protected function style($style, $value, $attr = array())

$v = htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
$v = preg_replace_callback(self::$controlCharsRx, function ($r) {
return sprintf('<span class=sf-dump-cchr title=\\x%02X>%s</span>', ord($r[0]), "\x7F" === $r[0] ? '?' : chr(64 + ord($r[0])));
// Use Unicode Control Pictures - see http://www.unicode.org/charts/PDF/U2400.pdf
return sprintf('<span class=sf-dump-cchr title=\\x%02X>&#%d;</span>', ord($r[0]), "\x7F" !== $r[0] ? 0x2400 + ord($r[0]) : 0x2421);
}, $v);

if ('ref' === $style) {
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/VarDumper/Tests/HtmlDumperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function testGet()
<span class=sf-dump-key>5</span> => <span class=sf-dump-num>-INF</span>
<span class=sf-dump-key>6</span> => <span class=sf-dump-num>{$intMax}</span>
"<span class=sf-dump-key>str</span>" => "<span class=sf-dump-str title="4 characters">d&#233;j&#224;</span>"
<span class=sf-dump-key>7</span> => b"<span class=sf-dump-str title="2 binary or non-UTF-8 characters">&#233;<span class=sf-dump-cchr title=\\x00>@</span></span>"
<span class=sf-dump-key>7</span> => b"<span class=sf-dump-str title="2 binary or non-UTF-8 characters">&#233;<span class=sf-dump-cchr title=\\x00>&#9216;</span></span>"
"<span class=sf-dump-key>[]</span>" => []
"<span class=sf-dump-key>res</span>" => <abbr title="`stream` resource" class=sf-dump-note>:stream</abbr> {<a class=sf-dump-ref>@{$res1}</a><samp>
<span class=sf-dump-meta>wrapper_type</span>: "<span class=sf-dump-str title="9 characters">plainfile</span>"
Expand Down

0 comments on commit cd076e4

Please sign in to comment.