Collection of drupal errors

July 30th, 2020
Error: Failed to start the session because headers have already been sent
RuntimeException: Failed to start the session because headers have already been sent by "/srv/www/project/vendor/symfony/http-foundation/Response.php" at line 377. in Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage->start() (line 145 of /srv/www/project/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php)
Solution: Return the response object, instend of ->send()

When returning a Redirect Response, return the response object.

	// BAD example.
	$response = new RedirectResponse('https://url/path');
	$response->send();

	// GOOD example.
	return new RedirectResponse('https://url/path');
wip note — This collection is WIP