diff --git a/src/Symfony/Component/Cache/Traits/PdoTrait.php b/src/Symfony/Component/Cache/Traits/PdoTrait.php index 9917bd91f545a..6d896fd55514e 100644 --- a/src/Symfony/Component/Cache/Traits/PdoTrait.php +++ b/src/Symfony/Component/Cache/Traits/PdoTrait.php @@ -306,14 +306,7 @@ protected function doSave(array $values, $lifetime) $now = time(); $lifetime = $lifetime ?: null; - try { - $stmt = $conn->prepare($sql); - } catch (TableNotFoundException $e) { - if (!$conn->isTransactionActive() || \in_array($this->driver, ['pgsql', 'sqlite', 'sqlsrv'], true)) { - $this->createTable(); - } - $stmt = $conn->prepare($sql); - } + $stmt = $conn->prepare($sql); if ('sqlsrv' === $driver || 'oci' === $driver) { $stmt->bindParam(1, $id); @@ -340,8 +333,14 @@ protected function doSave(array $values, $lifetime) } foreach ($values as $id => $data) { - $stmt->execute(); - + try { + $stmt->execute(); + } catch (TableNotFoundException $e) { + if (!$conn->isTransactionActive() || \in_array($this->driver, ['pgsql', 'sqlite', 'sqlsrv'], true)) { + $this->createTable(); + } + $stmt->execute(); + } if (null === $driver && !$stmt->rowCount()) { try { $insertStmt->execute();
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: