Bug #28083

Some unit tests fail with "Cannot modify header information"

Added by Xavier Perseguers over 9 years ago. Updated almost 3 years ago.

Status:
Closed
Priority:
Should have
Category:
-
Target version:
Start date:
2011-07-11
Due date:
% Done:

100%

TYPO3 Version:
4.6
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

When running Core unit tests, many of them fail with a t3lib_error_Exception thrown by a PHP warning:

#1: PHP Warning: Cannot modify header information - headers already sent by (output started at /path/to/typo3conf/ext/phpunit/Classes/BackEnd/Module.php:874) in /path/to/typo3/template.php line 813 (More information)

Related issues

Related to TYPO3 Core - Bug #18734: SQL debug output is not shown in the Backend Closed 2008-05-01

Associated revisions

Revision 29e70b5c (diff)
Added by Xavier Perseguers almost 9 years ago

[BUGFIX] Some unit tests fail with "Cannot modify header information"

Method template::endPage() should only send Content-Encoding header
if no headers have been sent to prevent fatal errors.

Change-Id: I57b84ac777a3e5dd7be601a670da7601116fd035
Fixes: #28083
Reviewed-on: http://review.typo3.org/3237
Reviewed-by: Steffen Gebert
Tested-by: Steffen Gebert
Reviewed-by: Xavier Perseguers
Tested-by: Xavier Perseguers

History

#1 Updated by Mr. Hudson over 9 years ago

Patch set 1 of change I57b84ac777a3e5dd7be601a670da7601116fd035 has been pushed to the review server.
It is available at http://review.typo3.org/3237

#2 Updated by Xavier Perseguers over 9 years ago

  • Status changed from New to Under Review
  • Target version set to 1281

#3 Updated by Mr. Hudson over 9 years ago

Patch set 2 of change I57b84ac777a3e5dd7be601a670da7601116fd035 has been pushed to the review server.
It is available at http://review.typo3.org/3237

#4 Updated by Mr. Hudson over 9 years ago

Patch set 3 of change I57b84ac777a3e5dd7be601a670da7601116fd035 has been pushed to the review server.
It is available at http://review.typo3.org/3237

#5 Updated by Xavier Perseguers over 9 years ago

  • Target version changed from 1281 to 4.6.0-beta1

#6 Updated by Xavier Perseguers about 9 years ago

  • Target version changed from 4.6.0-beta1 to 4.6.0-beta2

#7 Updated by Björn Pedersen about 9 years ago

With FirePHP ( both php module and TYPO3 extension) + FireDevlog (TYPO3 extension) installed, I get the following error backtrace:

Conclusion: buffer the complete output. That could probably happen on TYPO3 BE output level.

Uncaught TYPO3 Exception
Headers already sent in /home/webmaster/frm2/typo3conf/ext/phpunit/Classes/BackEnd/Module.php on line 874. Cannot send log data to FirePHP. You must have Output Buffering enabled via ob_start() or output_buffering ini directive.

Exception thrown in file
/home/webmaster/frm2/typo3conf/ext/fire_devlog/lib/FirePHP.class.php in line 1178.

11 FirePHP::newException("Headers already sent in /home/webmaster/frm2/typo3… via ob_start() or output_buffering ini directive.")

/home/webmaster/frm2/typo3conf/ext/fire_devlog/lib/FirePHP.class.php:

00755:                 echo '
FirePHP ERROR: Headers already sent in '.$filename.' on line '.$linenum.'. Cannot send log data to FirePHP. You must have Output Buffering enabled via ob_start() or output_buffering ini directive.
';
00756:             } else {

00757:                 throw $this->newException('Headers already sent in '.$filename.' on line '.$linenum.'. Cannot send log data to FirePHP. You must have Output Buffering enabled via ob_start() or output_buffering ini directive.');

00758:             }
00759:         }

10 FirePHP::fb("10.08.2011 09:14:29 by template: END of BACKEND session", "LOG")

9 call_user_func_array(array, array)

/home/webmaster/frm2/typo3conf/ext/fire_devlog/lib/fb.php:

00062:   
00063:     $args = func_get_args();

00064:     return call_user_func_array(array($instance,'fb'),$args);

00065: }
00066: 

8 fb("10.08.2011 09:14:29 by template: END of BACKEND session", "LOG")

/home/webmaster/frm2/typo3conf/ext/fire_devlog/class.tx_firedevlog.php:

00076:   ); 
00077:   

00078:   fb(date('d.m.Y H:i:s') . ' by ' . $logArr['extKey'] . ': ' . $logArr['msg'], $severity[$logArr['severity']]);

00079:   if (!empty($logArr['dataVar'])) {
00080:    fb($this->getPrintable ($logArr['dataVar']) . chr(10));

7 tx_firedevlog::devLog(array, boolean)

6 call_user_func_array(array, array)

/home/webmaster/frm2/typo3_src_git/t3lib/class.t3lib_div.php:

04547:       array(&$classObj, $parts[1]),
04548:       array(&$params, &$ref)

04549:      );

04550:     } else {
04551:      $errorMsg = "No method name '" . $parts[1] . "' in class " . $parts[0];

5 t3lib_div::callUserFunction("EXT:fire_devlog/class.tx_firedevlog.php:tx_firedevlog->devLog", array, boolean)

/home/webmaster/frm2/typo3_src_git/t3lib/class.t3lib_div.php:

05329:    $fakeThis = FALSE;
05330:    foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_div.php']['devLog'] as $hookMethod) {

05331:     self::callUserFunction($hookMethod, $params, $fakeThis);

05332:    }
05333:   }

4 t3lib_div::devLog("END of BACKEND session", "template", 0, array)

/home/webmaster/frm2/typo3_src_git/typo3/template.php:

00826: 
00827:    // Logging: Can't find better place to put it:

00828:   if (TYPO3_DLOG) t3lib_div::devLog('END of BACKEND session', 'template', 0, array('_FLUSH' => TRUE));

00829: 
00830:   return $str;

3 template::endPage()

/home/webmaster/frm2/typo3conf/ext/phpunit/Classes/BackEnd/Module.php:

00184:   }
00185: 

00186:   $this->output($this->doc->endPage());

00187:  }
00188: 

2 Tx_Phpunit_BackEnd_Module::main()

/home/webmaster/frm2/typo3conf/ext/phpunit/Classes/BackEnd/index.php:

00045: 
00046: $module = t3lib_div::makeInstance('Tx_Phpunit_BackEnd_Module');

00047: $module->main();

00048: ?>

1 require("/home/webmaster/frm2/typo3conf/ext/phpunit/Classes/BackEnd/index.php")

/home/webmaster/frm2/typo3_src_git/typo3/mod.php:

00043:  require($temp_path . 'conf.php');
00044:  $BACK_PATH = '';

00045:  require($temp_path . 'index.php');

00046:  $isDispatched = TRUE;
00047: } else {

#8 Updated by Xavier Perseguers about 9 years ago

  • Target version changed from 4.6.0-beta2 to 4.6.0-beta3

#9 Updated by Oliver Hader about 9 years ago

  • Target version changed from 4.6.0-beta3 to 4.6.0-RC1

#10 Updated by Xavier Perseguers about 9 years ago

  • Target version changed from 4.6.0-RC1 to 4.6.0

#11 Updated by Mr. Hudson almost 9 years ago

Patch set 4 of change I57b84ac777a3e5dd7be601a670da7601116fd035 has been pushed to the review server.
It is available at http://review.typo3.org/3237

#12 Updated by Mr. Hudson almost 9 years ago

Patch set 5 of change I57b84ac777a3e5dd7be601a670da7601116fd035 has been pushed to the review server.
It is available at http://review.typo3.org/3237

#13 Updated by Xavier Perseguers almost 9 years ago

  • Assignee set to Xavier Perseguers
  • % Done changed from 0 to 100

#14 Updated by Xavier Perseguers almost 9 years ago

  • Status changed from Under Review to Resolved

#15 Updated by Riccardo De Contardi almost 3 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF