pantheon-systems / pantheon_domain_masking

Domain Masking helper module for D8
GNU General Public License v2.0
11 stars 6 forks source link

cannot change the session module's ini settings while session is active #19

Open namespacebrian opened 2 years ago

namespacebrian commented 2 years ago

A customer is reporting this warning being thrown a lot: Warning: ini_set(): A session is active. You cannot change the session module's ini settings at this time en Drupal\\pantheon_domain_masking\\Middleware\\DomainMaskingMiddleware->handle() (línea 88 de /code/docroot/modules/contrib/pantheon_domain_masking/src/Middleware/DomainMaskingMiddleware.php)

Line in the code here: https://github.com/pantheon-systems/pantheon_domain_masking/blob/master/src/Middleware/DomainMaskingMiddleware.php#L88

Would it be possible to wrap this ini_set() in a check to see if a session has already been started?

This is just an idea/suggestion. This ticket can be closed if it's not helpful.

abutler3 commented 7 months ago

We are also seeing a similar message: `Warning: ini_set(): Session ini settings cannot be changed when a session is active in Drupal\pantheon_domain_masking\Middleware\DomainMaskingMiddleware->handle() (line 88 of /code/web/modules/contrib/pantheon_domain_masking-master/src/Middleware/DomainMaskingMiddleware.php)

0 /code/web/core/includes/bootstrap.inc(347): _drupal_error_handler_real(2, 'ini_set(): Sess...', '/code/web/modul...', 88)

1 [internal function]: _drupal_error_handler(2, 'ini_set(): Sess...', '/code/web/modul...', 88)

2 /code/web/modules/contrib/pantheon_domain_masking-master/src/Middleware/DomainMaskingMiddleware.php(88): iniset('session.cookie...', '/healthequity')

3 /code/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\pantheon_domain_masking\Middleware\DomainMaskingMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 2, true)

4 /code/web/core/lib/Drupal/Core/EventSubscriber/DefaultExceptionHtmlSubscriber.php(166): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 2)

5 /code/web/core/lib/Drupal/Core/EventSubscriber/DefaultExceptionHtmlSubscriber.php(122): Drupal\Core\EventSubscriber\DefaultExceptionHtmlSubscriber->makeSubrequest(Object(Symfony\Component\HttpKernel\Event\ExceptionEvent), '/system/404', 404)

6 /code/web/core/lib/Drupal/Core/EventSubscriber/HttpExceptionSubscriberBase.php(109): Drupal\Core\EventSubscriber\DefaultExceptionHtmlSubscriber->on404(Object(Symfony\Component\HttpKernel\Event\ExceptionEvent))

7 [internal function]: Drupal\Core\EventSubscriber\HttpExceptionSubscriberBase->onException(Object(Symfony\Component\HttpKernel\Event\ExceptionEvent), 'kernel.exceptio...', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))

8 /code/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(142): call_user_func(Array, Object(Symfony\Component\HttpKernel\Event\ExceptionEvent), 'kernel.exceptio...', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))

9 /code/vendor/symfony/http-kernel/HttpKernel.php(229): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object(Symfony\Component\HttpKernel\Event\ExceptionEvent), 'kernel.exceptio...')

10 /code/vendor/symfony/http-kernel/HttpKernel.php(92): Symfony\Component\HttpKernel\HttpKernel->handleThrowable(Object(Symfony\Component\HttpKernel\Exception\NotFoundHttpException), Object(Symfony\Component\HttpFoundation\Request), 1)

11 /code/web/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)

12 /code/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)

13 /code/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)

14 /code/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)

15 /code/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)

16 /code/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)

17 /code/web/modules/contrib/pantheon_domain_masking-master/src/Middleware/DomainMaskingMiddleware.php(124): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)

18 /code/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\pantheon_domain_masking\Middleware\DomainMaskingMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)

19 /code/web/core/lib/Drupal/Core/DrupalKernel.php(718): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)

20 /code/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))

21 {main}`