8000 [Cache][Lock] fix SQLSRV throws for method_exists() by GDmac · Pull Request #43330 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Cache][Lock] fix SQLSRV throws for method_exists() #43330

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

Merged
merged 1 commit into from
Oct 5, 2021
Merged
Show file tree
Hide file tree
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
8000
Diff view
4 changes: 2 additions & 2 deletions src/Symfony/Component/Cache/Traits/PdoTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public function createTable()
throw new \DomainException(sprintf('Creating the cache table is currently not implemented for PDO driver "%s".', $this->driver));
}

if (method_exists($conn, 'executeStatement')) {
if ($conn instanceof Connection && method_exists($conn, 'executeStatement')) {
$conn->executeStatement($sql);
} else {
$conn->exec($sql);
Expand Down Expand Up @@ -282,7 +282,7 @@ protected function doClear($namespace)
}

try {
if (method_exists($conn, 'executeStatement')) {
if ($conn instanceof Connection && method_exists($conn, 'executeStatement')) {
$conn->executeStatement($sql);
} else {
$conn->exec($sql);
Expand Down
6 changes: 3 additions & 3 deletions src/Symfony/Component/Lock/Store/PdoStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ public function createTable(): void
$table->setPrimaryKey([$this->idCol]);

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

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

$conn = $this->getConnection();
if (method_exists($conn, 'executeStatement')) {
if ($conn instanceof Connection && method_exists($conn, 'executeStatement')) {
$conn->executeStatement($sql);
} else {
$conn->exec($sql);
Expand Down
0