本文整理汇总了PHP中Drupal\Component\Utility\Crypt::randomBytesBase64方法的典型用法代码示例。如果您正苦于以下问题:PHP Crypt::randomBytesBase64方法的具体用法?PHP Crypt::randomBytesBase64怎么用?PHP Crypt::randomBytesBase64使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Drupal\Component\Utility\Crypt
的用法示例。
在下文中一共展示了Crypt::randomBytesBase64方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get
/**
* Generates a token based on $value, the user session, and the private key.
*
* The generated token is based on the session of the current user. Normally,
* anonymous users do not have a session, so the generated token will be
* different on every page request. To generate a token for users without a
* session, manually start a session prior to calling this function.
*
* @param string $value
* (optional) An additional value to base the token on.
*
* @return string
* A 43-character URL-safe token for validation, based on the token seed,
* the hash salt provided by Settings::getHashSalt(), and the
* 'drupal_private_key' configuration variable.
*
* @see \Drupal\Core\Site\Settings::getHashSalt()
* @see \Drupal\Core\Session\SessionManager::start()
*/
public function get($value = '')
{
if (empty($_SESSION['csrf_token_seed'])) {
$_SESSION['csrf_token_seed'] = Crypt::randomBytesBase64();
}
return $this->computeToken($_SESSION['csrf_token_seed'], $value);
}
示例2: setUp
/**
* {@inheritdoc}
*/
public function setUp()
{
parent::setUp();
$this->key = Crypt::randomBytesBase64(55);
$this->state = $this->getMock('Drupal\\Core\\State\\StateInterface');
$this->privateKey = new PrivateKey($this->state);
}
示例3: testGenerateSeedOnGet
/**
* Tests that a new token seed is generated upon first use.
*
* @covers ::get
*/
public function testGenerateSeedOnGet()
{
$key = Crypt::randomBytesBase64();
$this->privateKey->expects($this->any())->method('get')->will($this->returnValue($key));
$this->sessionMetadata->expects($this->once())->method('getCsrfTokenSeed')->will($this->returnValue(NULL));
$this->sessionMetadata->expects($this->once())->method('setCsrfTokenSeed')->with($this->isType('string'));
$this->assertInternalType('string', $this->generator->get());
}
示例4: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
$this->syncDirectory = $this->publicFilesDirectory . '/config_' . Crypt::randomBytesBase64() . '/sync';
$this->settings['config_directories'][CONFIG_SYNC_DIRECTORY] = (object) array('value' => $this->syncDirectory, 'required' => TRUE);
// Other directories will be created too.
$this->settings['config_directories']['custom'] = (object) array('value' => $this->publicFilesDirectory . '/config_custom', 'required' => TRUE);
parent::setUp();
}
示例5: get
/**
* Generates a token based on $value, the user session, and the private key.
*
* The generated token is based on the session of the current user. Normally,
* anonymous users do not have a session, so the generated token will be
* different on every page request. To generate a token for users without a
* session, manually start a session prior to calling this function.
*
* @param string $value
* (optional) An additional value to base the token on.
*
* @return string
* A 43-character URL-safe token for validation, based on the token seed,
* the hash salt provided by Settings::getHashSalt(), and the
* 'drupal_private_key' configuration variable.
*
* @see \Drupal\Core\Site\Settings::getHashSalt()
* @see \Symfony\Component\HttpFoundation\Session\SessionInterface::start()
*/
public function get($value = '')
{
$seed = $this->sessionMetadata->getCsrfTokenSeed();
if (empty($seed)) {
$seed = Crypt::randomBytesBase64();
$this->sessionMetadata->setCsrfTokenSeed($seed);
}
return $this->computeToken($seed, $value);
}
示例6: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
$this->configDirectory = $this->publicFilesDirectory . '/config_' . Crypt::randomBytesBase64();
$this->settings['config_directories'][CONFIG_SYNC_DIRECTORY] = (object) array('value' => $this->configDirectory . '/sync', 'required' => TRUE);
// Create the files directory early so we can test the error case.
mkdir($this->publicFilesDirectory);
// Create a file so the directory can not be created.
file_put_contents($this->configDirectory, 'Test');
parent::setUp();
}
示例7: setUp
/**
* {@inheritdoc}
*/
function setUp()
{
parent::setUp();
$this->key = Crypt::randomBytesBase64(55);
$this->privateKey = $this->getMockBuilder('Drupal\\Core\\PrivateKey')->disableOriginalConstructor()->setMethods(array('get'))->getMock();
$this->privateKey->expects($this->any())->method('get')->will($this->returnValue($this->key));
$settings = array('hash_salt' => $this->randomName());
new Settings($settings);
$this->generator = new CsrfTokenGenerator($this->privateKey);
}
示例8: preExecuteRequest
/**
* Build Acquia Solr Search Authenticator.
*
* @param PreExecuteRequestEvent $event
*/
public function preExecuteRequest($event)
{
$request = $event->getRequest();
$request->addParam('request_id', uniqid(), TRUE);
$endpoint = $this->client->getEndpoint();
$this->uri = $endpoint->getBaseUri() . $request->getUri();
$this->nonce = Crypt::randomBytesBase64(24);
$string = $request->getRawData();
if (!$string) {
$parsed_url = parse_url($this->uri);
$path = isset($parsed_url['path']) ? $parsed_url['path'] : '/';
$query = isset($parsed_url['query']) ? '?' . $parsed_url['query'] : '';
$string = $path . $query;
// For pings only.
}
$cookie = $this->calculateAuthCookie($string, $this->nonce);
$request->addHeader('Cookie: ' . $cookie);
$request->addHeader('User-Agent: ' . 'acquia_search/' . \Drupal::config('acquia_search.settings')->get('version'));
}
示例9: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
parent::setUp();
new Settings(array('hash_salt' => 'test'));
// Account 1: 'administrator' and 'authenticated' roles.
$roles_1 = array('administrator', 'authenticated');
$this->account_1 = $this->getMockBuilder('Drupal\\user\\Entity\\User')->disableOriginalConstructor()->setMethods(array('getRoles'))->getMock();
$this->account_1->expects($this->any())->method('getRoles')->will($this->returnValue($roles_1));
// Account 2: 'authenticated' and 'administrator' roles (different order).
$roles_2 = array('authenticated', 'administrator');
$this->account_2 = $this->getMockBuilder('Drupal\\user\\Entity\\User')->disableOriginalConstructor()->setMethods(array('getRoles'))->getMock();
$this->account_2->expects($this->any())->method('getRoles')->will($this->returnValue($roles_2));
// Updated account 1: now also 'editor' role.
$roles_1_updated = array('editor', 'administrator', 'authenticated');
$this->account_1_updated = $this->getMockBuilder('Drupal\\user\\Entity\\User')->disableOriginalConstructor()->setMethods(array('getRoles'))->getMock();
$this->account_1_updated->expects($this->any())->method('getRoles')->will($this->returnValue($roles_1_updated));
// Mocked private key + cache services.
$random = Crypt::randomBytesBase64(55);
$this->private_key = $this->getMockBuilder('Drupal\\Core\\PrivateKey')->disableOriginalConstructor()->setMethods(array('get'))->getMock();
$this->private_key->expects($this->any())->method('get')->will($this->returnValue($random));
$this->cache = $this->getMockBuilder('Drupal\\Core\\Cache\\CacheBackendInterface')->disableOriginalConstructor()->getMock();
$this->permissionsHash = new PermissionsHash($this->private_key, $this->cache);
}
示例10: sendNoJsPlaceholders
/**
* Sends no-JS BigPipe placeholders' replacements as embedded HTML responses.
*
* @param string $html
* HTML markup.
* @param array $no_js_placeholders
* Associative array; the no-JS BigPipe placeholders. Keys are the BigPipe
* selectors.
* @param \Drupal\Core\Asset\AttachedAssetsInterface $cumulative_assets
* The cumulative assets sent so far; to be updated while rendering no-JS
* BigPipe placeholders.
*/
protected function sendNoJsPlaceholders($html, $no_js_placeholders, AttachedAssetsInterface $cumulative_assets)
{
$fragments = explode('<div data-big-pipe-selector-nojs="', $html);
print array_shift($fragments);
ob_end_flush();
flush();
foreach ($fragments as $fragment) {
$t = explode('"></div>', $fragment, 2);
$placeholder = $t[0];
if (!isset($no_js_placeholders[$placeholder])) {
continue;
}
$token = Crypt::randomBytesBase64(55);
// Render the placeholder, but include the cumulative settings assets, so
// we can calculate the overall settings for the entire page.
$placeholder_plus_cumulative_settings = ['placeholder' => $no_js_placeholders[$placeholder], 'cumulative_settings_' . $token => ['#attached' => ['drupalSettings' => $cumulative_assets->getSettings()]]];
$elements = $this->renderPlaceholder($placeholder, $placeholder_plus_cumulative_settings);
// Create a new HtmlResponse. Ensure the CSS and (non-bottom) JS is sent
// before the HTML they're associated with. In other words: ensure the
// critical assets for this placeholder's markup are loaded first.
// @see \Drupal\Core\Render\HtmlResponseSubscriber
// @see template_preprocess_html()
$css_placeholder = '<nojs-bigpipe-placeholder-styles-placeholder token="' . $token . '">';
$js_placeholder = '<nojs-bigpipe-placeholder-scripts-placeholder token="' . $token . '">';
$elements['#markup'] = Markup::create($css_placeholder . $js_placeholder . (string) $elements['#markup']);
$elements['#attached']['html_response_attachment_placeholders']['styles'] = $css_placeholder;
$elements['#attached']['html_response_attachment_placeholders']['scripts'] = $js_placeholder;
$html_response = new HtmlResponse();
$html_response->setContent($elements);
$html_response->getCacheableMetadata()->setCacheMaxAge(0);
// Push a fake request with the asset libraries loaded so far and dispatch
// KernelEvents::RESPONSE event. This results in the attachments for the
// HTML response being processed by HtmlResponseAttachmentsProcessor and
// hence:
// - the HTML to load the CSS can be rendered.
// - the HTML to load the JS (at the top) can be rendered.
$fake_request = $this->requestStack->getMasterRequest()->duplicate();
$fake_request->request->set('ajax_page_state', ['libraries' => implode(',', $cumulative_assets->getAlreadyLoadedLibraries())] + $cumulative_assets->getSettings()['ajaxPageState']);
$this->requestStack->push($fake_request);
$event = new FilterResponseEvent($this->httpKernel, $fake_request, HttpKernelInterface::SUB_REQUEST, $html_response);
$this->eventDispatcher->dispatch(KernelEvents::RESPONSE, $event);
$html_response = $event->getResponse();
$this->requestStack->pop();
// Send this embedded HTML response.
print $html_response->getContent();
print $t[1];
flush();
// Another placeholder was rendered and sent, track the set of asset
// libraries sent so far. Any new settings also need to be tracked, so
// they can be sent in ::sendPreBody().
// @todo What if drupalSettings already was printed in the HTML <head>? That case is not yet handled. In that case, no-JS BigPipe would cause broken (incomplete) drupalSettings… This would not matter if it were only used if JS is not enabled, but that's not the only use case. However, this
$final_settings = $html_response->getAttachments()['drupalSettings'];
$cumulative_assets->setAlreadyLoadedLibraries(explode(',', $final_settings['ajaxPageState']['libraries']));
$cumulative_assets->setSettings($final_settings);
}
}
示例11: submitForm
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state)
{
/** @var $user \Drupal\user\UserInterface */
$user = $form_state->getValue('user');
user_login_finalize($user);
$this->logger->notice('User %name used one-time login link at time %timestamp.', array('%name' => $user->getUsername(), '%timestamp' => $form_state->getValue('timestamp')));
drupal_set_message($this->t('You have just used your one-time login link. It is no longer necessary to use this link to log in. Please change your password.'));
// Let the user's password be changed without the current password check.
$token = Crypt::randomBytesBase64(55);
$_SESSION['pass_reset_' . $user->id()] = $token;
$form_state->setRedirect('entity.user.edit_form', array('user' => $user->id()), array('query' => array('pass-reset-token' => $token), 'absolute' => TRUE));
}
示例12: generateCachePlaceholder
/**
* {@inheritdoc}
*/
public function generateCachePlaceholder($callback, array &$context)
{
if (is_string($callback) && strpos($callback, '::') === FALSE) {
$callable = $this->controllerResolver->getControllerFromDefinition($callback);
} else {
$callable = $callback;
}
if (!is_callable($callable)) {
throw new \InvalidArgumentException('$callable must be a callable function or of the form service_id:method.');
}
// Generate a unique token if one is not already provided.
$context += ['token' => Crypt::randomBytesBase64(55)];
return '<drupal-render-cache-placeholder callback="' . $callback . '" token="' . $context['token'] . '"></drupal-render-cache-placeholder>';
}
示例13: sendNoJsPlaceholders
/**
* Sends no-JS BigPipe placeholders' replacements as embedded HTML responses.
*
* @param string $html
* HTML markup.
* @param array $no_js_placeholders
* Associative array; the no-JS BigPipe placeholders. Keys are the BigPipe
* selectors.
* @param \Drupal\Core\Asset\AttachedAssetsInterface $cumulative_assets
* The cumulative assets sent so far; to be updated while rendering no-JS
* BigPipe placeholders.
*/
protected function sendNoJsPlaceholders($html, $no_js_placeholders, AttachedAssetsInterface $cumulative_assets)
{
// Split the HTML on every no-JS placeholder string.
$prepare_for_preg_split = function ($placeholder_string) {
return '(' . preg_quote($placeholder_string, '/') . ')';
};
$preg_placeholder_strings = array_map($prepare_for_preg_split, array_keys($no_js_placeholders));
$fragments = preg_split('/' . implode('|', $preg_placeholder_strings) . '/', $html, NULL, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
foreach ($fragments as $fragment) {
// If the fragment isn't one of the no-JS placeholders, it is the HTML in
// between placeholders and it must be printed & flushed immediately. The
// rest of the logic in the loop handles the placeholders.
if (!isset($no_js_placeholders[$fragment])) {
print $fragment;
flush();
continue;
}
$placeholder = $fragment;
assert('isset($no_js_placeholders[$placeholder])');
$token = Crypt::randomBytesBase64(55);
// Render the placeholder, but include the cumulative settings assets, so
// we can calculate the overall settings for the entire page.
$placeholder_plus_cumulative_settings = ['placeholder' => $no_js_placeholders[$placeholder], 'cumulative_settings_' . $token => ['#attached' => ['drupalSettings' => $cumulative_assets->getSettings()]]];
$elements = $this->renderPlaceholder($placeholder, $placeholder_plus_cumulative_settings);
// Create a new HtmlResponse. Ensure the CSS and (non-bottom) JS is sent
// before the HTML they're associated with. In other words: ensure the
// critical assets for this placeholder's markup are loaded first.
// @see \Drupal\Core\Render\HtmlResponseSubscriber
// @see template_preprocess_html()
$css_placeholder = '<nojs-bigpipe-placeholder-styles-placeholder token="' . $token . '">';
$js_placeholder = '<nojs-bigpipe-placeholder-scripts-placeholder token="' . $token . '">';
$elements['#markup'] = Markup::create($css_placeholder . $js_placeholder . (string) $elements['#markup']);
$elements['#attached']['html_response_attachment_placeholders']['styles'] = $css_placeholder;
$elements['#attached']['html_response_attachment_placeholders']['scripts'] = $js_placeholder;
$html_response = new HtmlResponse();
$html_response->setContent($elements);
$html_response->getCacheableMetadata()->setCacheMaxAge(0);
// Push a fake request with the asset libraries loaded so far and dispatch
// KernelEvents::RESPONSE event. This results in the attachments for the
// HTML response being processed by HtmlResponseAttachmentsProcessor and
// hence:
// - the HTML to load the CSS can be rendered.
// - the HTML to load the JS (at the top) can be rendered.
$fake_request = $this->requestStack->getMasterRequest()->duplicate();
$fake_request->request->set('ajax_page_state', ['libraries' => implode(',', $cumulative_assets->getAlreadyLoadedLibraries())]);
$this->requestStack->push($fake_request);
$event = new FilterResponseEvent($this->httpKernel, $fake_request, HttpKernelInterface::SUB_REQUEST, $html_response);
$this->eventDispatcher->dispatch(KernelEvents::RESPONSE, $event);
$html_response = $event->getResponse();
$this->requestStack->pop();
// Send this embedded HTML response.
print $html_response->getContent();
flush();
// Another placeholder was rendered and sent, track the set of asset
// libraries sent so far. Any new settings also need to be tracked, so
// they can be sent in ::sendPreBody().
// @todo What if drupalSettings already was printed in the HTML <head>? That case is not yet handled. In that case, no-JS BigPipe would cause broken (incomplete) drupalSettings… This would not matter if it were only used if JS is not enabled, but that's not the only use case. However, this
$cumulative_assets->setAlreadyLoadedLibraries(array_merge($cumulative_assets->getAlreadyLoadedLibraries(), $html_response->getAttachments()['library']));
$cumulative_assets->setSettings($html_response->getAttachments()['drupalSettings']);
}
}
示例14: testChildElementPlaceholder
/**
* Tests child element that uses #post_render_cache but that is rendered via a
* template.
*/
public function testChildElementPlaceholder()
{
$this->setupMemoryCache();
// Simulate the theme system/Twig: a recursive call to Renderer::render(),
// just like the theme system or a Twig template would have done.
$this->themeManager->expects($this->any())->method('render')->willReturnCallback(function ($hook, $vars) {
return $this->renderer->render($vars['foo']) . "\n";
});
$context = ['bar' => $this->randomContextValue(), 'token' => \Drupal\Component\Utility\Crypt::randomBytesBase64(55)];
$callback = __NAMESPACE__ . '\\PostRenderCache::placeholder';
$placeholder = \Drupal::service('renderer')->generateCachePlaceholder($callback, $context);
$test_element = ['#theme' => 'some_theme_function', 'foo' => ['#post_render_cache' => [$callback => [$context]], '#markup' => $placeholder, '#prefix' => '<pre>', '#suffix' => '</pre>']];
$expected_output = '<pre><bar>' . $context['bar'] . '</bar></pre>' . "\n";
// #cache disabled.
$element = $test_element;
$output = $this->renderer->renderRoot($element);
$this->assertSame($output, $expected_output, 'Placeholder was replaced in output');
$expected_js_settings = ['common_test' => $context];
$this->assertSame($element['#attached']['drupalSettings'], $expected_js_settings, '#attached is modified; JavaScript setting is added to page.');
// GET request: #cache enabled, cache miss.
$this->setUpRequest();
$element = $test_element;
$element['#cache'] = ['cid' => 'render_cache_placeholder_test_GET'];
$element['foo']['#cache'] = ['cid' => 'render_cache_placeholder_test_child_GET'];
// Render, which will use the common-test-render-element.html.twig template.
$output = $this->renderer->renderRoot($element);
$this->assertSame($output, $expected_output, 'Placeholder was replaced in output');
$this->assertTrue(isset($element['#printed']), 'No cache hit');
$this->assertSame($element['#markup'], $expected_output, 'Placeholder was replaced in #markup.');
$this->assertSame($element['#attached']['drupalSettings'], $expected_js_settings, '#attached is modified; JavaScript setting is added to page.');
// GET request: validate cached data for child element.
$expected_token = $context['token'];
$cached_element = $this->memoryCache->get('render_cache_placeholder_test_child_GET')->data;
// Parse unique token out of the cached markup.
$dom = Html::load($cached_element['#markup']);
$xpath = new \DOMXPath($dom);
$nodes = $xpath->query('//*[@token]');
$this->assertEquals(1, $nodes->length, 'The token attribute was found in the cached child element markup');
$token = '';
if ($nodes->length) {
$token = $nodes->item(0)->getAttribute('token');
}
$this->assertSame($token, $expected_token, 'The tokens are identical for the child element');
// Verify the token is in the cached element.
$expected_element = ['#markup' => '<pre><drupal-render-cache-placeholder callback="' . $callback . '" token="' . $expected_token . '"></drupal-render-cache-placeholder></pre>', '#attached' => [], '#post_render_cache' => [$callback => [$context]], '#cache' => ['contexts' => [], 'tags' => [], 'max-age' => Cache::PERMANENT]];
$this->assertSame($cached_element, $expected_element, 'The correct data is cached for the child element: the stored #markup and #attached properties are not affected by #post_render_cache callbacks.');
// GET request: validate cached data (for the parent/entire render array).
$cached_element = $this->memoryCache->get('render_cache_placeholder_test_GET')->data;
// Parse unique token out of the cached markup.
$dom = Html::load($cached_element['#markup']);
$xpath = new \DOMXPath($dom);
$nodes = $xpath->query('//*[@token]');
$this->assertEquals(1, $nodes->length, 'The token attribute was found in the cached parent element markup');
$token = '';
if ($nodes->length) {
$token = $nodes->item(0)->getAttribute('token');
}
$this->assertSame($token, $expected_token, 'The tokens are identical for the parent element');
// Verify the token is in the cached element.
$expected_element = ['#markup' => '<pre><drupal-render-cache-placeholder callback="' . $callback . '" token="' . $expected_token . '"></drupal-render-cache-placeholder></pre>' . "\n", '#attached' => [], '#post_render_cache' => [$callback => [$context]], '#cache' => ['contexts' => [], 'tags' => [], 'max-age' => Cache::PERMANENT]];
$this->assertSame($cached_element, $expected_element, 'The correct data is cached for the parent element: the stored #markup and #attached properties are not affected by #post_render_cache callbacks.');
// GET request: validate cached data.
// Check the cache of the child element again after the parent has been
// rendered.
$cached_element = $this->memoryCache->get('render_cache_placeholder_test_child_GET')->data;
// Verify that the child element contains the correct
// render_cache_placeholder markup.
$dom = Html::load($cached_element['#markup']);
$xpath = new \DOMXPath($dom);
$nodes = $xpath->query('//*[@token]');
$this->assertEquals(1, $nodes->length, 'The token attribute was found in the cached child element markup');
$token = '';
if ($nodes->length) {
$token = $nodes->item(0)->getAttribute('token');
}
$this->assertSame($token, $expected_token, 'The tokens are identical for the child element');
// Verify the token is in the cached element.
$expected_element = ['#markup' => '<pre><drupal-render-cache-placeholder callback="' . $callback . '" token="' . $expected_token . '"></drupal-render-cache-placeholder></pre>', '#attached' => [], '#post_render_cache' => [$callback => [$context]], '#cache' => ['contexts' => [], 'tags' => [], 'max-age' => Cache::PERMANENT]];
$this->assertSame($cached_element, $expected_element, 'The correct data is cached for the child element: the stored #markup and #attached properties are not affected by #post_render_cache callbacks.');
// GET request: #cache enabled, cache hit.
$element = $test_element;
$element['#cache'] = ['cid' => 'render_cache_placeholder_test_GET'];
// Render, which will use the common-test-render-element.html.twig template.
$output = $this->renderer->renderRoot($element);
$this->assertSame($output, $expected_output, 'Placeholder was replaced in output');
$this->assertFalse(isset($element['#printed']), 'Cache hit');
$this->assertSame($element['#markup'], $expected_output, 'Placeholder was replaced in #markup.');
$this->assertSame($element['#attached']['drupalSettings'], $expected_js_settings, '#attached is modified; JavaScript setting is added to page.');
}
示例15: regenerate
/**
* {@inheritdoc}
*/
public function regenerate($destroy = FALSE, $lifetime = NULL)
{
// Nothing to do if we are not allowed to change the session.
if ($this->isCli()) {
return;
}
// We do not support the optional $destroy and $lifetime parameters as long
// as #2238561 remains open.
if ($destroy || isset($lifetime)) {
throw new \InvalidArgumentException('The optional parameters $destroy and $lifetime of SessionManager::regenerate() are not supported currently');
}
if ($this->isStarted()) {
$old_session_id = $this->getId();
}
session_id(Crypt::randomBytesBase64());
$this->getMetadataBag()->clearCsrfTokenSeed();
if (isset($old_session_id)) {
$params = session_get_cookie_params();
$expire = $params['lifetime'] ? REQUEST_TIME + $params['lifetime'] : 0;
setcookie($this->getName(), $this->getId(), $expire, $params['path'], $params['domain'], $params['secure'], $params['httponly']);
$this->migrateStoredSession($old_session_id);
}
if (!$this->isStarted()) {
// Start the session when it doesn't exist yet.
$this->startNow();
}
}