From cd076e4cb7e16a74e3348d1353993f8b4d9cc295 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 4 Nov 2014 10:51:20 +0100 Subject: [PATCH] [VarDumper] Use Unicode Control Pictures --- src/Symfony/Component/VarDumper/Cloner/AbstractCloner.php | 1 - src/Symfony/Component/VarDumper/Dumper/CliDumper.php | 2 +- src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php | 5 +++-- src/Symfony/Component/VarDumper/Tests/HtmlDumperTest.php | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Symfony/Component/VarDumper/Cloner/AbstractCloner.php b/src/Symfony/Component/VarDumper/Cloner/AbstractCloner.php index 66fbf82f8244d..240f925b6c067 100644 --- a/src/Symfony/Component/VarDumper/Cloner/AbstractCloner.php +++ b/src/Symfony/Component/VarDumper/Cloner/AbstractCloner.php @@ -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(); diff --git a/src/Symfony/Component/VarDumper/Dumper/CliDumper.php b/src/Symfony/Component/VarDumper/Dumper/CliDumper.php index a6df0c8cee03d..6a171649bf7f4 100644 --- a/src/Symfony/Component/VarDumper/Dumper/CliDumper.php +++ b/src/Symfony/Component/VarDumper/Dumper/CliDumper.php @@ -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)).' '; } } } diff --git a/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php b/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php index 6aba8145ef5e5..30c3253129e1e 100644 --- a/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php +++ b/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php @@ -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', @@ -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('%s', 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('&#%d;', ord($r[0]), "\x7F" !== $r[0] ? 0x2400 + ord($r[0]) : 0x2421); }, $v); if ('ref' === $style) { diff --git a/src/Symfony/Component/VarDumper/Tests/HtmlDumperTest.php b/src/Symfony/Component/VarDumper/Tests/HtmlDumperTest.php index b3ec2adbe1257..fc8a15f09fa61 100644 --- a/src/Symfony/Component/VarDumper/Tests/HtmlDumperTest.php +++ b/src/Symfony/Component/VarDumper/Tests/HtmlDumperTest.php @@ -62,7 +62,7 @@ public function testGet() 5 => -INF 6 => {$intMax} "str" => "déjà" - 7 => b"é@" + 7 => b"é" "[]" => [] "res" => :stream {@{$res1} wrapper_type: "plainfile"