Hello.

I'm getting a PHP warning, followed by a Runtime exception. Not 100% if it's related to the form mode manager, but it looks like it.

Warning :

Warning: session_id(): Cannot change session id when headers already sent in Drupal\Core\Session\SessionManager->regenerate() (line 222 of /var/www/html/core/lib/Drupal/Core/Session/SessionManager.php) #0 /var/www/html/core/includes/bootstrap.inc(582): _drupal_error_handler_real(2, 'session_id(): C...', '/var/www/html/c...', 222, Array) #1 [internal function]: _drupal_error_handler(2, 'session_id(): C...', '/var/www/html/c...', 222, Array) #2 /var/www/html/core/lib/Drupal/Core/Session/SessionManager.php(222): session_id('PGF-3UgfBa-cVFM...') #3 /var/www/html/vendor/symfony/http-foundation/Session/Session.php(188): Drupal\Core\Session\SessionManager->regenerate(false, NULL) #4 /var/www/html/core/modules/user/user.module(564): Symfony\Component\HttpFoundation\Session\Session->migrate() #5 /var/www/html/core/modules/user/src/RegisterForm.php(111): user_login_finalize(Object(Drupal\user\Entity\User)) #6 [internal function]: Drupal\user\RegisterForm->save(Array, Object(Drupal\Core\Form\FormState)) #7 /var/www/html/core/lib/Drupal/Core/Form/FormSubmitter.php(111): call_user_func_array(Array, Array) #8 /var/www/html/core/lib/Drupal/Core/Form/FormSubmitter.php(51): Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object(Drupal\Core\Form\FormState)) #9 /var/www/html/core/lib/Drupal/Core/Form/FormBuilder.php(589): Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object(Drupal\Core\Form\FormState)) #10 /var/www/html/core/lib/Drupal/Core/Form/FormBuilder.php(318): Drupal\Core\Form\FormBuilder->processForm('user_regi_form', Array, Object(Drupal\Core\Form\FormState)) #11 /var/www/html/modules/contrib/form_mode_manager/src/AbstractEntityFormModesFactory.php(372): Drupal\Core\Form\FormBuilder->buildForm('user_regi_form', Object(Drupal\Core\Form\FormState)) #12 /var/www/html/modules/contrib/form_mode_manager/src/AbstractEntityFormModesFactory.php(204): Drupal\form_mode_manager\AbstractEntityFormModesFactory->getForm(Object(Drupal\user\Entity\User), 'fmm_regi') #13 /var/www/html/modules/contrib/form_mode_manager/src/Controller/FormModeManagerEntityController.php(206): Drupal\form_mode_manager\AbstractEntityFormModesFactory->entityAdd(Object(Drupal\Core\Routing\RouteMatch)) #14 /var/www/html/modules/contrib/form_mode_manager/src/Controller/FormModeManagerEntityController.php(163): Drupal\form_mode_manager\Controller\FormModeManagerEntityController->getEntityControllerResponse('entityAdd', Object(Drupal\Core\Routing\RouteMatch)) #15 [internal function]: Drupal\form_mode_manager\Controller\FormModeManagerEntityController->entityAdd(Object(Drupal\Core\Routing\RouteMatch)) #16 /var/www/html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array) #17 /var/www/html/core/lib/Drupal/Core/Render/Renderer.php(582): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #18 /var/www/html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure)) #19 /var/www/html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) #20 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(151): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #21 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1) #22 /var/www/html/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #23 /var/www/html/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #24 /var/www/html/core/modules/page_cache/src/StackMiddleware/PageCache.php(99): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #25 /var/www/html/core/modules/page_cache/src/StackMiddleware/PageCache.php(78): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true) #26 /var/www/html/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #27 /var/www/html/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #28 /var/www/html/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #29 /var/www/html/core/lib/Drupal/Core/DrupalKernel.php(666): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #30 /var/www/html/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #31 {main}.

Runtime exception

Failed to start the session because headers have already been sent by "/var/www/html/vendor/symfony/http-foundation/Response.php" at line 360. in Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage->start() (line 141 of /var/www/html/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php).

Comments

dendreten created an issue. See original summary.

woprrr’s picture

Category: Support request » Bug report
Priority: Major » Normal

This kind of exception aren't caused by Form Mode Manager but more caused by PHP 7.2. but yes in PHP 7.2 a warning is generated now. However this never worked as intended, it just failed silently.

Can you describe more your reproduction path ? But I didn't think that error was generated by FMM at all but more D8 + 7.2+

dendreten’s picture

it happens when two modules interact : the Form Mode Manager (2.0 rc1) and Business Rules (1.0-beta1).

I don't have the issues with :
- Form Mode Manager 2.0 rc1 (with the patch for role assignment) without Business Rules (tested in environment drupal 8.5.7 and php 7.2.9)
- Business Rules using "Multiple Registration" instead of FFM for the automatic assignment of a role upon registration (tested in environment drupal 8.5.6 and php 7.1.11 with dev desktop).

dendreten’s picture

Status: Active » Closed (works as designed)

this seems to be a general drupal issue, unrelated to the FMM module...