Project

General

Profile

Actions

Bug #60893

closed

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

Added by Jonas Felix over 9 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Must have
Assignee:
Category:
Extbase
Target version:
Start date:
2014-08-11
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
Tags:
Complexity:
no-brainer
Is Regression:
No
Sprint Focus:

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.

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.

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

This is the proposed solution which does not influence the regular use with $return=false, which means regular echo...

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) . '</pre>
                </div>
            </div>
            ';
        }

        if ($return === TRUE) {
            $output = $css . $output;
            return $output;
        } else {
            echo $css;
            echo $output;
        }
Actions

Also available in: Atom PDF