Fixed Bug #6828: Using outpug buffering for debug() to prevent "Headers already sent...
authorIngmar Schlecht <ingmar.schlecht@typo3.org>
Sun, 25 Nov 2007 16:18:46 +0000 (16:18 +0000)
committerIngmar Schlecht <ingmar.schlecht@typo3.org>
Sun, 25 Nov 2007 16:18:46 +0000 (16:18 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@2769 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/class.t3lib_div.php

index 2832504..6dfe18c 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2007-11-25  Ingmar Schlecht  <ingmar@typo3.org>
+
+       * Fixed Bug #6828: Using outpug buffering for debug() to prevent "Headers already sent" errors
+
 2007-11-25  Benjamin Mack  <mack@xnos.org>
 
        * Feature #6829: New general template methods for FE & BE (Thanks to Steffen Kamper)
index b94ed10..7b9efa1 100755 (executable)
@@ -2902,6 +2902,11 @@ class t3lib_div {
         * @return      void
         */
        function debug($var='',$brOrHeader=0)   {
+                       // buffer the output of debug if no buffering started before
+               if (ob_get_level()==0) {
+                       ob_start();
+               }
+
                if ($brOrHeader && !t3lib_div::testInt($brOrHeader))    {
                        echo '<table class="typo3-debug" border="0" cellpadding="0" cellspacing="0" bgcolor="white" style="border:0px; margin-top:3px; margin-bottom:3px;"><tr><td style="background-color:#bbbbbb; font-family: verdana,arial; font-weight: bold; font-size: 10px;">'.htmlspecialchars((string)$brOrHeader).'</td></tr><tr><td>';
                } elseif ($brOrHeader<0)        {