Bug #60893

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

Added by Jonas Felix almost 7 years ago. Updated almost 3 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;
        }
#1

Updated by Alexander Opitz almost 7 years ago

  • Project changed from 534 to TYPO3 Core
  • Category changed from Extbase: Utility to Extbase
  • TYPO3 Version set to 6.2
  • Is Regression set to No
#2

Updated by Riccardo De Contardi over 5 years ago

  • Target version set to Candidate for patchlevel

still true for 7.6.1 (latest master)

#3

Updated by Gerrit Code Review over 5 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/45147

#4

Updated by Benni Mack over 5 years ago

  • Assignee set to Benni Mack
  • Target version changed from Candidate for patchlevel to next-patchlevel
#5

Updated by Benni Mack over 5 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 80 to 100
#6

Updated by Benni Mack almost 3 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF