Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions Classes/Core/Functional/FunctionalTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -1005,6 +1005,7 @@ private function retrieveFrontendSubRequestResult(
$_SERVER['SCRIPT_NAME'] = '/index.php';
$_SERVER['HTTP_HOST'] = $_SERVER['SERVER_NAME'] = $request->getUri()->getHost() ?: 'localhost';

$outputBufferingLevel = ob_get_level();
$container = Bootstrap::init(ClassLoadingInformation::getClassLoader());

/** @var InternalRequest $serverRequest */
Expand Down Expand Up @@ -1050,8 +1051,12 @@ private function retrieveFrontendSubRequestResult(
$frontendApplication = $container->get(Application::class);
$response = $frontendApplication->handle($serverRequest);
} finally {
// Somewhere an ob_start() is called in frontend that is not cleaned. Work around that for now.
ob_end_clean();
// TYPO3 v14 opens an implicit output buffer in Bootstrap::init(), TYPO3 v15
// does not. Frontend or extension code may leave further buffers open. Drop
// everything opened by the sub request, but never phpunit's own buffer.
while (ob_get_level() > $outputBufferingLevel) {
ob_end_clean();
}
FrameworkState::pop();
}
return $response;
Expand Down
9 changes: 7 additions & 2 deletions Classes/Core/Testbase.php
Original file line number Diff line number Diff line change
Expand Up @@ -754,10 +754,15 @@ public function setUpBasicTypo3Bootstrap(string $instancePath): ContainerInterfa

$classLoader = require $this->getPackagesPath() . '/autoload.php';
SystemEnvironmentBuilder::run(0, SystemEnvironmentBuilder::REQUESTTYPE_CLI, false);
$outputBufferingLevel = ob_get_level();
$container = Bootstrap::init($classLoader);
// Make sure output is not buffered, so command-line output can take place and
// phpunit does not whine about changed output bufferings in tests.
ob_end_clean();
// phpunit does not whine about changed output bufferings in tests. TYPO3 v14
// opens an implicit output buffer in Bootstrap::init(), TYPO3 v15 does not.
// Only drop buffers opened by the bootstrap, never phpunit's own one.
while (ob_get_level() > $outputBufferingLevel) {
ob_end_clean();
}

$this->dumpClassLoadingInformation();

Expand Down