Question

I use Zend_Debug::dump to dump variables into a Zend_Log file. How can I get it to stop wrapping the output in HTML tags?

The documentaion says "If the output stream is detected as a web presentation, the output of var_dump() is escaped using » htmlspecialchars() and wrapped with (X)HTML tags." Why does it think my log file is a web presentation?

The method for the dump function has a boolean $echo flag. Even when this is FALSE, I get HTML markup in my log files.

Thanks for you help!

Was it helpful?

Solution

Zend Debug is always using htmlspecialchars() to quote. You cant disable this by an provided parameter.

The boolean for "echo" is only used to disable the var_dump() (wich is used in Zend_Debug) printing to the browser.

Code from Zend_Debug::dump():

$output = htmlspecialchars($output, ENT_QUOTES);

    if (self::getSapi() == 'cli') {
        $output = PHP_EOL . $label
                . PHP_EOL . $output
                . PHP_EOL;
    } else {
        if(!extension_loaded('xdebug')) {
            $output = htmlspecialchars($output, ENT_QUOTES);
        }

        $output = '<pre>'
                . $label
                . $output
                . '</pre>';
    }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top