paths = $paths; $this->session = $session; } /** * @param ServerRequestInterface $request * @param RequestHandlerInterface $handler * @return ResponseInterface */ public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface { $return = $handler->handle($request); $cookies = $request->getCookieParams(); if ( $this->session instanceof NativeSessionStorage && in_array($request->getAttribute('route-request-path'), $this->paths) && !isset($cookies[$this->session->getName()]) ) { $this->destroyNative(); } return $return; } /** * @return bool * @codeCoverageIgnore */ protected function destroyNative() { return session_destroy(); } }