google-code-export / zfdebug

Automatically exported from code.google.com/p/zfdebug
Other
1 stars 1 forks source link

Header output should be appended (not prefixed) – fixes 2 issues #49

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Change (in ZFDebug_Controller_Plugin_Debug::_output()):

$response->setBody(preg_replace('/(<head.*>)/i', '$1' .
$this->_headerOutput(), $response->getBody()));

To:

$response->setBody(preg_replace('/(<\/head>)/i', $this->_headerOutput() .
PHP_EOL . '$1', $response->getBody()));

... actually regex isn't really required.

Issues fixed:

1. "Can't execute code from a freed script" error in IE.
2. jQuery is loaded twice if you've referenced it already.

Original issue reported on code.google.com by glen...@gmail.com on 1 May 2010 at 1:49

GoogleCodeExporter commented 9 years ago
Personally - I changed the _output() function to look like this:

    protected function _output($html)
    {
        $response = $this->getResponse();
        $response->setBody(str_ireplace('</body>', '<div 
id="ZFDebug_debug">'.$html.'</div>' . $this->_headerOutput() . '</body>', 
$response-
>getBody()));
    }

Javascript should be loaded and executed at the bottom of the page - not the 
top.

Original comment by leeked on 6 May 2010 at 3:38

GoogleCodeExporter commented 9 years ago
Fixed in trunk

Original comment by gugakf...@gmail.com on 6 Jul 2010 at 12:58