Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d65f9ee

Browse filesBrowse files
committed
fix SQLSRV throws for method_exists()
pdo_sqlsrv driver 5.9.0 throws an exception for any call on method_exists(). (see microsoft/msphpsql/issues/1306) executeStatement() is a DBAL-method, exec() is PDO. fix by excluding method_exists() check on PDO type of connections
1 parent 57f5df5 commit d65f9ee
Copy full SHA for d65f9ee

File tree

Expand file treeCollapse file tree

2 files changed

+5
-5
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+5
-5
lines changed

‎src/Symfony/Component/Cache/Traits/PdoTrait.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Cache/Traits/PdoTrait.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ public function createTable()
150150
throw new \DomainException(sprintf('Creating the cache table is currently not implemented for PDO driver "%s".', $this->driver));
151151
}
152152

153-
if (method_exists($conn, 'executeStatement')) {
153+
if ($conn instanceof Connection && method_exists($conn, 'executeStatement')) {
154154
$conn->executeStatement($sql);
155155
} else {
156156
$conn->exec($sql);
@@ -282,7 +282,7 @@ protected function doClear($namespace)
282282
}
283283

284284
try {
285-
if (method_exists($conn, 'executeStatement')) {
285+
if ($conn instanceof Connection && method_exists($conn, 'executeStatement')) {
286286
$conn->executeStatement($sql);
287287
} else {
288288
$conn->exec($sql);

‎src/Symfony/Component/Lock/Store/PdoStore.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Lock/Store/PdoStore.php
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ public function createTable(): void
268268
$table->setPrimaryKey([$this->idCol]);
269269

270270
foreach ($schema->toSql($conn->getDatabasePlatform()) as $sql) {
271-
if (method_exists($conn, 'executeStatement')) {
271+
if ($conn instanceof Connection && method_exists($conn, 'executeStatement')) {
272272
$conn->executeStatement($sql);
273273
} else {
274274
$conn->exec($sql);
@@ -298,7 +298,7 @@ public function createTable(): void
298298
throw new \DomainException(sprintf('Creating the lock table is currently not implemented for PDO driver "%s".', $driver));
299299
}
300300

301-
if (method_exists($conn, 'executeStatement')) {
301+
if ($conn instanceof Connection && method_exists($conn, 'executeStatement')) {
302302
$conn->executeStatement($sql);
303303
} else {
304304
$conn->exec($sql);
@@ -313,7 +313,7 @@ private function prune(): void
313313
$sql = "DELETE FROM $this->table WHERE $this->expirationCol <= {$this->getCurrentTimestampStatement()}";
314314

315315
$conn = $this->getConnection();
316-
if (method_exists($conn, 'executeStatement')) {
316+
if ($conn instanceof Connection && method_exists($conn, 'executeStatement')) {
317317
$conn->executeStatement($sql);
318318
} else {
319319
$conn->exec($sql);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.