- Issue created by @koosvdkolk
- 🇳🇱Netherlands koosvdkolk
So I took a dive in this issue. The problem arises at the very end of a batch process, so the last call closing the whole thing.
SimpleAccessLog.php around line 103 has
if ($route = $request->attributes->get(RouteObjectInterface::ROUTE_OBJECT)) { $access_log['title'] = (is_array(\Drupal::service('title_resolver')->getTitle($request, $route))?\Drupal::service('title_resolver')->getTitle($request, $route)['#markup']:\Drupal::service('title_resolver')->getTitle($request, $route)); }
This calls the title resolver service.
In class TitleResolver::getTitle it will try to obtain the route's title dynamically when in a batch process. Around line 56
if ($callback = $route->getDefault('_title_callback')) { $callable = $this->controllerResolver->getControllerFromDefinition($callback); $arguments = $this->argumentResolver->getArguments($request, $callable); $route_title = call_user_func_array($callable, $arguments); }
$callable has the value of 'batchPageTitle'. This is a function of class BatchController. Around line 87
public function batchPageTitle(Request $request) { $batch = &batch_get(); if (!($request_id = $request->query->get('id'))) { return ''; } // Retrieve the current state of the batch. if (!$batch) { $batch = $this->batchStorage->load($request_id); } ...
As $batch will be 'NULL' at the end of the batch process, it will call the batchStorage to load itself. The BatchStorage's 'load' function will then start the session around line 72, which will trigger the error
/** * {@inheritdoc} */ public function load($id) { // Ensure that a session is started before using the CSRF token generator. $this->session->start(); ...
- 🇳🇱Netherlands koosvdkolk
Workaround: Exclude the "/batch" path in admin/config/system/simple_access_log