I am testing upgrade to Drupal 9. I upgraded core and logged in and fixed a few issues with module deprecated code and then was presented with a Twig issue where replace syntax had changed. I changed a few views that had embedded twig syntax to rewrite some results and logged out.

On trying to log back in to continue with views amendments I found that the admin login (or any other user) would not work. The anon user home page just refreshed with no error messages. The username and password are correct.

I used drush to get a one time login which successfully logged me in but the problem persists. I get the following log message of type 'php':

RuntimeException: Failed to start the session because headers have already been sent by "/home/mark/lampstack-8.1.4-0/apache2/htdocs/pd-net-dev/vendor/symfony/http-foundation/Response.php" at line 1239. in Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage->start() (line 152 of /home/mark/lampstack-8.1.4-0/apache2/htdocs/pd-net-dev/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php)

Any assistance in interpreting this and resolving the issue would be welcome

PHP version is 8.1.4

  • What contrib modules are on the site? For example, this exists drupal.org/project/redirect_after_login/issues/3214949
    – cilefen
    Apr 14, 2022 at 12:34
  • Sometimes this can be caused by custom controller code that returns the wrong response or prematurely returns the response. I suggest looking into custom modules you have that deal with custom responses or modules that deal with redirects.
    – Joseph
    Apr 14, 2022 at 14:05
  • I would first check there are PHP files with a closing PHP tag (?>). That is the cause of that exception, in most of the cases.
    – apaderno
    Apr 14, 2022 at 22:50
  • Thanks for the various responses. I do use redirect_after_login enabled but don't think I need it anymore so will test removing that. This has only been an issue since upgrade to 9.3 though. I don't have any custom modules. Apr 15, 2022 at 14:42


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.