Skip to content

Commit e6898e4

Browse files
committed
Merge branch '5.4' into 6.0
* 5.4: fix SQLSRV throws for method_exists() [HttpKernel] Add basic support for language negotiation [Messenger] Add a middleware to log when transaction has been left open [HttpClient] Add method to set response factory in mock client Move array_merge calls out of loops to improve performance Remove references to DBALException [VarDumper] Fix handling of "new" in initializers on PHP 8.1
2 parents e0e275d + f2a9080 commit e6898e4

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

Store/PdoStore.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@
1212
namespace Symfony\Component\Lock\Store;
1313

1414
use Doctrine\DBAL\Connection;
15-
use Doctrine\DBAL\DBALException;
1615
use Doctrine\DBAL\DriverManager;
17-
use Doctrine\DBAL\Exception;
16+
use Doctrine\DBAL\Exception as DBALException;
1817
use Doctrine\DBAL\Exception\TableNotFoundException;
1918
use Doctrine\DBAL\Schema\Schema;
2019
use Symfony\Component\Lock\Exception\InvalidArgumentException;
@@ -141,7 +140,7 @@ public function save(Key $key)
141140
$this->createTable();
142141
}
143142
$stmt->execute();
144-
} catch (DBALException | Exception $e) {
143+
} catch (DBALException $e) {
145144
// the lock is already acquired. It could be us. Let's try to put off.
146145
$this->putOffExpiration($key, $this->initialTtl);
147146
} catch (\PDOException $e) {
@@ -252,7 +251,6 @@ private function getConnection(): \PDO|Connection
252251
*
253252
* @throws \PDOException When the table already exists
254253
* @throws DBALException When the table already exists
255-
* @throws Exception When the table already exists
256254
* @throws \DomainException When an unsupported PDO driver is used
257255
*/
258256
public function createTable(): void
@@ -266,7 +264,7 @@ public function createTable(): void
266264
$this->addTableToSchema($schema);
267265

268266
foreach ($schema->toSql($conn->getDatabasePlatform()) as $sql) {
269-
if (method_exists($conn, 'executeStatement')) {
267+
if ($conn instanceof Connection && method_exists($conn, 'executeStatement')) {
270268
$conn->executeStatement($sql);
271269
} else {
272270
$conn->exec($sql);
@@ -296,7 +294,7 @@ public function createTable(): void
296294
throw new \DomainException(sprintf('Creating the lock table is currently not implemented for platform "%s".', $driver));
297295
}
298296

299-
if (method_exists($conn, 'executeStatement')) {
297+
if ($conn instanceof Connection && method_exists($conn, 'executeStatement')) {
300298
$conn->executeStatement($sql);
301299
} else {
302300
$conn->exec($sql);
@@ -327,7 +325,7 @@ private function prune(): void
327325
$sql = "DELETE FROM $this->table WHERE $this->expirationCol <= {$this->getCurrentTimestampStatement()}";
328326

329327
$conn = $this->getConnection();
330-
if (method_exists($conn, 'executeStatement')) {
328+
if ($conn instanceof Connection && method_exists($conn, 'executeStatement')) {
331329
$conn->executeStatement($sql);
332330
} else {
333331
$conn->exec($sql);

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@
2020
"psr/log": "^1|^2|^3"
2121
},
2222
"require-dev": {
23-
"doctrine/dbal": "^2.10|^3.0",
23+
"doctrine/dbal": "^2.13|^3.0",
2424
"mongodb/mongodb": "~1.1",
2525
"predis/predis": "~1.0"
2626
},
2727
"conflict": {
28-
"doctrine/dbal": "<2.10"
28+
"doctrine/dbal": "<2.13"
2929
},
3030
"autoload": {
3131
"psr-4": { "Symfony\\Component\\Lock\\": "" },

0 commit comments

Comments
 (0)