Skip to content

Commit d02066f

Browse files
Merge pull request #536 from GNfsys/xdebug-dump-quirk-fix
Fix Zend_Debug::dump() xdebug quirk.
2 parents 02e968a + 40d49c3 commit d02066f

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

library/Zend/Debug.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,19 +82,20 @@ public static function dump($var, $label=null, $echo=true)
8282
var_dump($var);
8383
$output = ob_get_clean();
8484

85-
// neaten the newlines and indents
86-
$output = preg_replace("/\]\=\>\n(\s+)/m", "] => ", $output);
85+
$varDumpIsOverloaded = extension_loaded('xdebug') && str_contains((string) ini_get('xdebug.mode'), 'develop');
86+
87+
if (!$varDumpIsOverloaded) {
88+
// neaten the newlines and indents
89+
$output = preg_replace("/\]\=\>\n(\s+)/m", '] => ', $output);
90+
}
91+
8792
if (self::getSapi() == 'cli') {
8893
$output = PHP_EOL . $label
8994
. PHP_EOL . $output
9095
. PHP_EOL;
9196
} else {
92-
if(!extension_loaded('xdebug')) {
93-
$flags = ENT_QUOTES;
94-
// PHP 5.4.0+
95-
if (defined('ENT_SUBSTITUTE')) {
96-
$flags = ENT_QUOTES | ENT_SUBSTITUTE;
97-
}
97+
if (!$varDumpIsOverloaded) {
98+
$flags = ENT_QUOTES | ENT_SUBSTITUTE;
9899
$output = htmlspecialchars($output, $flags);
99100
}
100101

0 commit comments

Comments
 (0)