ZF-1663: Zend_Debug::dump will display html entities when xdebug is loaded

Description

When xdebug is loaded, the output of var_dump() is 'beautifulled'. Since Zend_Debug::dump() work on regular var_dump output, it failed.

Work around is to tell to var_dump to no output html entities by using init_set and html_erros entry

here it is a patch


Index: Debug.php
===================================================================
--- Debug.php   (revision 953)
+++ Debug.php   (working copy)
@@ -30,7 +30,7 @@
 class Zend_Debug
 {
 
-    /**
+   /**
      * @var string
      */
     protected static $_sapi = null;
@@ -76,10 +76,20 @@
         // format the label
         $label = ($label===null) ? '' : rtrim($label) . ' ';
 
+        // Save old value of html_errors
+        $oldIni = ini_get('html_errors');
+        // Set value to no html if needed
+       if($oldIni != 0) {
+           ini_set('html_errors',0);
+       }
         // var_dump the variable into a buffer and keep the output
         ob_start();
         var_dump($var);
         $output = ob_get_clean();
+        // Restore html_errors value
+       if($oldIni != 0) {
+           ini_set('html_errors',$oldIni);
+       }
 
         // neaten the newlines and indents
         $output = preg_replace("/\]\=\>\n(\s+)/m", "] => ", $output); 

Comments

Honestly, i do not think we should implement this, but rather leave it up to userland. We could hardly implement a workaround for each debug facility, and still make it look pretty. But that's just my thought...

I dont think html_errors is dedicated to xdebug. This is a standard parameter of php. xdebug just follow it s value. I dont know what other thing is influenced by this parameter but equivalent bugs may occure if it s not corrected.

Fix version after 1.0.1.

Changing to 'Unassigned'

Changing issues in preparation for the 1.7.0 release.