Skip to content

Commit

Permalink
fix Debug::getEscaper() never called at dump() when xdebug is not loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
samsonasik committed Oct 21, 2013
1 parent 855cffa commit cb9ef4a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion library/Zend/Debug/Debug.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
10 changes: 10 additions & 0 deletions tests/ZendTest/Debug/DebugTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,14 @@ public function testXdebugEnabledAndNonCliSapiDoesNotEscapeSpecialChars()
$this->assertContains("</pre>", $result);
}

public function testDebugHaveEscaper()
{
$escaper = new \Zend\Escaper\Escaper;
Debug::setEscaper($escaper);

$a = array("a" => "<script type=\"text/javascript\"");
$result = Debug::dump($a, "LABEL", false);
$this->assertContains("&lt;script type=&quot;text/javascript&quot;&quot;", $result);
}

}

0 comments on commit cb9ef4a

Please sign in to comment.