Doctrine Common
  1. Doctrine Common
  2. DCOM-245

doContains method in MemcacheCache cache provider class returning wrong values

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 2.2
    • Fix Version/s: None
    • Component/s: Caching
    • Labels:
    • Environment:
      dev, test and prod

      Description

      Method doContains in MemcacheCache cache provider class looks like this

      
          /**
           * {@inheritdoc}
           */
          protected function doContains($id)
          {
              return (bool) $this->memcache->get($id);
          }
      
      

      In the case of an empty array stored, the result of casting an empty array is false but actually there's a value in cache with they key $id. As a matter of fact, when you take a look at MemcachedCache cache provider class, the doContains method looks like this:

          /**
           * {@inheritdoc}
           */
          protected function doContains($id)
          {
              return (false !== $this->memcached->get($id));
          }
      

      Which is more accurate in terms of the existance of a value in cache for $id. I had to have a workaround with the above code to make it work with Memcache.

      Is there any reason it is like that in MemcacheCache cache provider class and not in MemcachedCache cache provider class?

        Activity

        Hide
        Marco Pivetta added a comment -

        Javier Mellado can you please open a PR for this? The fix seems trivial, but it just needs a test in order to merge.

        Show
        Marco Pivetta added a comment - Javier Mellado can you please open a PR for this? The fix seems trivial, but it just needs a test in order to merge.
        Hide
        Javier Mellado added a comment -

        Excuse me Marco, what is a PR? I'll be more than happy to do so.

        Show
        Javier Mellado added a comment - Excuse me Marco, what is a PR? I'll be more than happy to do so.
        Hide
        Marco Pivetta added a comment -

        Javier Mellado pull request on github. If you don't then it may just be fixed in future as soon as someone picks it.

        Show
        Marco Pivetta added a comment - Javier Mellado pull request on github. If you don't then it may just be fixed in future as soon as someone picks it.

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Javier Mellado
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated: