Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Request.php

function Request::hasSession

Whether the request contains a Session object.

This method does not give any information about the state of the session object, like whether the session is started or not. It is just a way to check if this Request is associated with a Session instance.

Parameters

bool $skipIfUninitialized When true, ignores factories injected by `setSessionFactory`:

1 call to Request::hasSession()
Request::hasPreviousSession in vendor/symfony/http-foundation/Request.php
Whether the request contains a Session which was started in one of the previous requests.

File

vendor/symfony/http-foundation/Request.php, line 711

Class

Request
Request represents an HTTP request.

Namespace

Symfony\Component\HttpFoundation

Code

public function hasSession(bool $skipIfUninitialized = false) : bool {
    return null !== $this->session && (!$skipIfUninitialized || $this->session instanceof SessionInterface);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal