Issue Bug Closed

#60893IE quirks mode by <f:debug inline="true"> and \TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump (solution included)

Jonas Felix 08/11/14, 16:10 updated 10/02/18, 11:52

Description

<f:debug inline="true"> or DebuggerUtility::var_dump(…$return = 1) output the css above the <doctype> and thereby set the IE to quirks mode.</doctype></f:debug>

Of course in production this has to be disabled, but there are many cases you want to test in IE with inline <f:debug> or even have some extension that has a DebuggerUtility::var_dump at some place with a $return = 1.</f:debug>

The best solution we find is to also return the $css if you want to put the debugging inline. As researched all browsers accept the <style> tag within the <body> but will have much bigger problems when having the <style> tage before the <Doctype>.</p> <p>This is the proposed solution which does not influence the regular use with $return=false, which means regular echo&#8230;</p> <p>

if (!$plainText && self::$stylesheetEchoed === FALSE) {
            $css = '
                <style type=\'text/css\'>
                    ...
                </style>';
            self::$stylesheetEchoed = TRUE;
        }
        if ($plainText) {
            $output = $title . PHP_EOL . self::renderDump($variable, 0, TRUE, $ansiColors) . PHP_EOL . PHP_EOL;
        } else {
            $output = '
                <div class="Extbase-Utility-Debugger-VarDump ' . ($return ? 'Extbase-Utility-Debugger-VarDump-Inline' : 'Extbase-Utility-Debugger-VarDump-Floating') . '">
                <div class="Extbase-Utility-Debugger-VarDump-Top">' . htmlspecialchars($title) . '</div>
                <div class="Extbase-Utility-Debugger-VarDump-Center">
                    <pre dir="ltr">' . self::renderDump($variable, 0, FALSE, FALSE) . '
</p> <p>
</div>
</div>
‘;
}
</p> <p>
if ($return === TRUE) {
$output = $css . $output;
return $output;
} else {
echo $css;
echo $output;
}
</pre>
</p></style>

Reviews 1