Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fad43be

Browse files
bug #49097 [HttpFoundation] inject SessionHandler in PdoSessionHandlerSchemaSubscriber (alli83)
This PR was merged into the 6.3 branch. Discussion ---------- [HttpFoundation] inject SessionHandler in PdoSessionHandlerSchemaSubscriber | Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | yes | New feature? | no | Deprecations? | no | License | MIT | Doc PR | I'm working on it following the PR symfony/symfony#48059. In symfony/symfony#48059, it works only if you put the handler explicitly to PdoSessionHandler in the configuration (handler_id) but it stops working if the session is defined by the factory and we can't use it as follow: ```` handler_id: '%env(resolve:DATABASE_URL)%' ````` Linked to DoctrineBundle PR doctrine/DoctrineBundle#1623 Also imho, I think the second argument of configureSchema inPdoSessionHandler should be optional and set to return true if not defined since the function is public eg. one wants to add the table to the Schema. Commits ------- 9aded06c0c [HttpFoundation] inject SessionHandler in PdoSessionHandlerSchemaSubscriber
2 parents cde7c2f + aff3a3c commit fad43be

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Session/Storage/Handler/PdoSessionHandler.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,12 @@ public function __construct(#[\SensitiveParameter] \PDO|string $pdoOrDsn = null,
178178
$this->ttl = $options['ttl'] ?? null;
179179
}
180180

181-
public function configureSchema(Schema $schema, \Closure $isSameDatabase): void
181+
/**
182+
* Adds the Table to the Schema if it doesn't exist.
183+
*/
184+
public function configureSchema(Schema $schema, \Closure $isSameDatabase = null): void
182185
{
183-
if ($schema->hasTable($this->table) || !$isSameDatabase($this->getConnection()->exec(...))) {
186+
if ($schema->hasTable($this->table) || ($isSameDatabase && !$isSameDatabase($this->getConnection()->exec(...)))) {
184187
return;
185188
}
186189

0 commit comments

Comments
 (0)