Issues

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

Issue Type: Bug Created: 2007-07-02T04:43:39.000+0000 Last Updated: 2008-11-13T14:09:59.000+0000 Status: Resolved Fix version(s): - 1.7.0 (17/Nov/08)

Reporter: Laurent Taupiac. (titerm) Assignee: Benjamin Eberlei (beberlei) Tags: - Zend_Debug

Related issues: - ZF-4136

Attachments:

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

<pre class="highlight">
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

Posted by Andries Seutens (andries) on 2007-07-09T09:29:46.000+0000

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...

Posted by Laurent Taupiac. (titerm) on 2007-07-09T10:29:43.000+0000

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.

Posted by Darby Felton (darby) on 2007-07-30T09:30:23.000+0000

Fix version after 1.0.1.

Posted by Bill Karwin (bkarwin) on 2007-10-17T15:28:44.000+0000

Changing to 'Unassigned'

Posted by Wil Sinclair (wil) on 2008-11-13T14:09:59.000+0000

Changing issues in preparation for the 1.7.0 release.

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts