Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[10.x] Set container instance on session manager #46621

Merged
merged 2 commits into from
Mar 31, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 21 additions & 21 deletions src/Illuminate/Session/SessionManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ protected function createNullDriver()
protected function createArrayDriver()
{
return $this->buildSession(new ArraySessionHandler(
$this->config->get('session.lifetime')
$this->container['config']->get('session.lifetime')
));
}

Expand All @@ -51,8 +51,8 @@ protected function createCookieDriver()
{
return $this->buildSession(new CookieSessionHandler(
$this->container->make('cookie'),
$this->config->get('session.lifetime'),
$this->config->get('session.expire_on_close')
$this->container['config']->get('session.lifetime'),
$this->container['config']->get('session.expire_on_close')
));
}

Expand All @@ -73,10 +73,10 @@ protected function createFileDriver()
*/
protected function createNativeDriver()
{
$lifetime = $this->config->get('session.lifetime');
$lifetime = $this->container['config']->get('session.lifetime');

return $this->buildSession(new FileSessionHandler(
$this->container->make('files'), $this->config->get('session.files'), $lifetime
$this->container->make('files'), $this->container['config']->get('session.files'), $lifetime
));
}

Expand All @@ -87,9 +87,9 @@ protected function createNativeDriver()
*/
protected function createDatabaseDriver()
{
$table = $this->config->get('session.table');
$table = $this->container['config']->get('session.table');

$lifetime = $this->config->get('session.lifetime');
$lifetime = $this->container['config']->get('session.lifetime');

return $this->buildSession(new DatabaseSessionHandler(
$this->getDatabaseConnection(), $table, $lifetime, $this->container
Expand All @@ -103,7 +103,7 @@ protected function createDatabaseDriver()
*/
protected function getDatabaseConnection()
{
$connection = $this->config->get('session.connection');
$connection = $this->container['config']->get('session.connection');

return $this->container->make('db')->connection($connection);
}
Expand Down Expand Up @@ -138,7 +138,7 @@ protected function createRedisDriver()
$handler = $this->createCacheHandler('redis');

$handler->getCache()->getStore()->setConnection(
$this->config->get('session.connection')
$this->container['config']->get('session.connection')
);

return $this->buildSession($handler);
Expand Down Expand Up @@ -173,11 +173,11 @@ protected function createCacheBased($driver)
*/
protected function createCacheHandler($driver)
{
$store = $this->config->get('session.store') ?: $driver;
$store = $this->container['config']->get('session.store') ?: $driver;

return new CacheBasedSessionHandler(
clone $this->container->make('cache')->store($store),
$this->config->get('session.lifetime')
$this->container['config']->get('session.lifetime')
);
}

Expand All @@ -189,13 +189,13 @@ protected function createCacheHandler($driver)
*/
protected function buildSession($handler)
{
return $this->config->get('session.encrypt')
return $this->container['config']->get('session.encrypt')
? $this->buildEncryptedSession($handler)
: new Store(
$this->config->get('session.cookie'),
$this->container['config']->get('session.cookie'),
$handler,
$id = null,
$this->config->get('session.serialization', 'php')
$this->container['config']->get('session.serialization', 'php')
);
}

Expand All @@ -208,11 +208,11 @@ protected function buildSession($handler)
protected function buildEncryptedSession($handler)
{
return new EncryptedStore(
$this->config->get('session.cookie'),
$this->container['config']->get('session.cookie'),
$handler,
$this->container['encrypter'],
$id = null,
$this->config->get('session.serialization', 'php'),
$this->container['config']->get('session.serialization', 'php'),
);
}

Expand All @@ -223,7 +223,7 @@ protected function buildEncryptedSession($handler)
*/
public function shouldBlock()
{
return $this->config->get('session.block', false);
return $this->container['config']->get('session.block', false);
}

/**
Expand All @@ -233,7 +233,7 @@ public function shouldBlock()
*/
public function blockDriver()
{
return $this->config->get('session.block_store');
return $this->container['config']->get('session.block_store');
}

/**
Expand All @@ -243,7 +243,7 @@ public function blockDriver()
*/
public function getSessionConfig()
{
return $this->config->get('session');
return $this->container['config']->get('session');
}

/**
Expand All @@ -253,7 +253,7 @@ public function getSessionConfig()
*/
public function getDefaultDriver()
{
return $this->config->get('session.driver');
return $this->container['config']->get('session.driver');
}

/**
Expand All @@ -264,6 +264,6 @@ public function getDefaultDriver()
*/
public function setDefaultDriver($name)
{
$this->config->set('session.driver', $name);
$this->container['config']->set('session.driver', $name);
}
}