function SessionTestController::traceHandlerRewriteUnmodified
Returns an updated trace recorded by test proxy session handlers as JSON.
The session data is rewritten without modification to invoke `\SessionUpdateTimestampHandlerInterface::updateTimestamp`.
Expects that there is an existing stacked session handler trace as recorded by `traceHandler()`.
Parameters
\Symfony\Component\HttpFoundation\Request $request: The incoming request.
Throws
\AssertionError
1 string reference to 'SessionTestController::traceHandlerRewriteUnmodified'
- session_test.routing.yml in core/
modules/ system/ tests/ modules/ session_test/ session_test.routing.yml - core/modules/system/tests/modules/session_test/session_test.routing.yml
File
-
core/
modules/ system/ tests/ modules/ session_test/ src/ Controller/ SessionTestController.php, line 161
Class
- SessionTestController
- Controller providing page callbacks for session tests.
Namespace
Drupal\session_test\ControllerCode
public function traceHandlerRewriteUnmodified(Request $request) : Response {
// Assert that there is an existing session with stacked handler trace data.
$session = $request->getSession();
assert(is_int($session->get('trace-handler')) && $session->get('trace-handler') > 0, 'Existing stacked session handler trace not found');
// Save unmodified session data.
assert(ini_get('session.lazy_write'), 'session.lazy_write must be enabled to invoke updateTimestamp()');
$session->save();
// Collect traces and return them in JSON format.
$trace = \Drupal::service('session_test.session_handler_proxy_trace')->getArrayCopy();
return new JsonResponse($trace);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.