From c05a5cfc7df7c1700c45e91c75465daaadb6582e Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Tue, 8 Oct 2013 14:11:31 +0700 Subject: [PATCH 1/5] fix Debug::getEscaper() never called at dump() when xdebug is not loaded --- src/Debug.php | 2 +- test/DebugTest.php | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Debug.php b/src/Debug.php index e20c500..7dfc508 100644 --- a/src/Debug.php +++ b/src/Debug.php @@ -104,7 +104,7 @@ public static function dump($var, $label = null, $echo = true) . PHP_EOL . $output . PHP_EOL; } else { - if (!extension_loaded('xdebug')) { + if (!extension_loaded('xdebug') || null !== static::$escaper) { $output = static::getEscaper()->escapeHtml($output); } diff --git a/test/DebugTest.php b/test/DebugTest.php index 36b80c2..3b7ac9f 100644 --- a/test/DebugTest.php +++ b/test/DebugTest.php @@ -94,4 +94,14 @@ public function testXdebugEnabledAndNonCliSapiDoesNotEscapeSpecialChars() $this->assertContains("", $result); } + public function testDebugHaveEscaper() + { + $escaper = new \Zend\Escaper\Escaper; + Debug::setEscaper($escaper); + + $a = array("a" => "