Skip to content

Bug when using pdo driver in Symfony/cache #23313

@zhouyl

Description

@zhouyl
Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Symfony version all version

A error encountered when managing cache with pdo::

[2017-06-28 15:29:27][cache][WARNING]: Failed to fetch key "{key}" {"key":"xfoo","exception":"[object] (PDOException(code: HY093): SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens at ~/vendor/symfony/cache/Traits/PdoTrait.php:173)"} []

It needs to be modified in Traits/PdoTrait.php(This bug could be found in ALL versions of symfony/cache):

https://github.com/symfony/cache/blob/master/Traits/PdoTrait.php#L173
https://github.com/symfony/cache/blob/3.2/Adapter/PdoAdapter.php#L198

diff --git a/Traits/PdoTrait.php b/Traits/PdoTrait.php
--- a/Traits/PdoTrait.php
+++ b/Traits/PdoTrait.php
@@ -170,7 +170,7 @@ trait PdoTrait
             foreach ($expired as $id) {
                 $stmt->bindValue(++$i, $id);
             }
-            $stmt->execute($expired);
+            $stmt->execute();
         }
     }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions