Skip to content

Commit b2d34ad

Browse files
Merge branch '5.4' into 6.2
* 5.4: Fix Doctrine deprecations [Validator] Remove internal from methods on non-internal interfaces [PhpUnitBridge] Fix support for the NO_COLOR env var
2 parents df27f41 + f64671e commit b2d34ad

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

Session/Storage/Handler/PdoSessionHandler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,8 +325,8 @@ public function updateTimestamp(string $sessionId, string $data): bool
325325
$updateStmt = $this->pdo->prepare(
326326
"UPDATE $this->table SET $this->lifetimeCol = :expiry, $this->timeCol = :time WHERE $this->idCol = :id"
327327
);
328-
$updateStmt->bindParam(':id', $sessionId, \PDO::PARAM_STR);
329-
$updateStmt->bindParam(':expiry', $expiry, \PDO::PARAM_INT);
328+
$updateStmt->bindValue(':id', $sessionId, \PDO::PARAM_STR);
329+
$updateStmt->bindValue(':expiry', $expiry, \PDO::PARAM_INT);
330330
$updateStmt->bindValue(':time', time(), \PDO::PARAM_INT);
331331
$updateStmt->execute();
332332
} catch (\PDOException $e) {

Session/Storage/Handler/SessionHandlerFactory.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@
1111

1212
namespace Symfony\Component\HttpFoundation\Session\Storage\Handler;
1313

14+
use Doctrine\DBAL\Configuration;
1415
use Doctrine\DBAL\DriverManager;
16+
use Doctrine\DBAL\Schema\DefaultSchemaManagerFactory;
17+
use Doctrine\DBAL\Tools\DsnParser;
18+
use Doctrine\ORM\ORMSetup;
1519
use Symfony\Component\Cache\Adapter\AbstractAdapter;
1620

1721
/**
@@ -65,7 +69,15 @@ public static function createHandler(object|string $connection, array $options =
6569
if (!class_exists(DriverManager::class)) {
6670
throw new \InvalidArgumentException(sprintf('Unsupported DSN "%s". Try running "composer require doctrine/dbal".', $connection));
6771
}
68-
$connection = DriverManager::getConnection(['url' => $connection])->getWrappedConnection();
72+
$connection[3] = '-';
73+
$params = class_exists(DsnParser::class) ? (new DsnParser())->parse($connection) : ['url' => $connection];
74+
$config = class_exists(ORMSetup::class) ? ORMSetup::createConfiguration(true) : new Configuration();
75+
if (class_exists(DefaultSchemaManagerFactory::class)) {
76+
$config->setSchemaManagerFactory(new DefaultSchemaManagerFactory());
77+
}
78+
79+
$connection = DriverManager::getConnection($params, $config);
80+
$connection = method_exists($connection, 'getNativeConnection') ? $connection->getNativeConnection() : $connection->getWrappedConnection();
6981
// no break;
7082

7183
case str_starts_with($connection, 'mssql://'):

0 commit comments

Comments
 (0)