Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-3198

[GH-1075] Fixed query cache id generation: added platform to hash


    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.5
    • Component/s: None
    • Security Level: All
    • Labels:


      This issue is created automatically through a Github pull request on behalf of vilartoni:



      There's an issue with the query cache id generation in `Doctrine\ORM\Query::_getQueryCacheId()`.

      If you happen to use different connections to different platforms on the same project and you're using the query cache, you will get an exception the moment you try to execute a query which SQL is different depending on the platform and it has been previously cached for the other platform, as they will share the same cache id.

      In order to reproduce the bug it is sufficient with using the Doctrine Paginator in a query:

      $query = $queryBuilder->setFirstResult(0)

      If we run the query for the first time with an empty cache in an Oracle connection and later on we try to run the same query in a MySQL connection, we get the following exception:

      SQLSTATE[42S22]: Column not found: 1054 Unknown column 'ROWNUM' in 'where clause'

      As it's trying to execute the SQL for Oracle in the MySQL connection due to the same cache id.

      This issue can be easily fixed just by taking the platform type into account in the cache id generation.


        Doctrine Bot created issue -
        Doctrine Bot added a comment -

        A related Github Pull-Request [GH-1075] was closed:

        Doctrine Bot added a comment - A related Github Pull-Request [GH-1075] was closed:
        Marco Pivetta added a comment - Merged:
        Marco Pivetta made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Assignee Benjamin Eberlei [ beberlei ] Marco Pivetta [ ocramius ]
        Fix Version/s 2.5 [ 10522 ]
        Resolution Fixed [ 1 ]

        This list may be incomplete, as errors occurred whilst retrieving source from linked applications:

        • Request to failed: Error in remote call to 'FishEye 0 (' ( [AbstractRestCommand{path='/rest-service-fe/search-v1/crossRepositoryQuery', params={query=DDC-3198, expand=changesets[0:20].revisions[0:29],reviews}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)


          • Assignee:
            Marco Pivetta
            Doctrine Bot
          • Votes:
            0 Vote for this issue
            2 Start watching this issue


            • Created: