Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.1.2, 1.1.4
    • Fix Version/s: 1.2.0
    • Component/s: library
    • Security Level: Public
    • Labels:
      None
    • Environment:
      Ubuntu 12.04 / Apache 2 / PHP5 / libcouchbase - 2.0.5

      Description

      This bug didn't exist in 1.1.0dp5, but I've seen it before in php-memcached. The issue is when issuing a setMulti() array into CB it doesn't like it if the key is not a string.

      $key = 12345
      $value = 67890

      $value = json_encode($value);
      $array[$key] = $value;

      $cb_obj->setMulti($array,$expire);

      PHP Fatal error: Uncaught exception 'CouchbaseIllegalKeyException' with message 'Invalid key specified (not a string)'

      test2.php(67): Couchbase->setMulti(Array, 604800)

      The reference bug for php-memcached is: https://bugs.php.net/bug.php?id=59016

      After experiencing the issue there I recompiled their newest version and it fixed the problem. I'm not sure if you can dovetail off of that work or not.

      # Subject Project Status CR V
      For Gerrit Dashboard: &For+PCBC-227=message:PCBC-227

        Activity

        Hide
        kneeoh Knee Oh added a comment -

        I forgot to mention, I'm loading a memcached bucket not a CB bucket.

        Show
        kneeoh Knee Oh added a comment - I forgot to mention, I'm loading a memcached bucket not a CB bucket.
        Hide
        mnunberg Mark Nunberg added a comment -

        So the problem is here:

        https://github.com/couchbase/php-ext-couchbase/blob/9c1842fd5fd5c3e776ea85d85db1f7d5d5430c11/store.c#L673

        Should look something like:
        https://github.com/couchbase/php-ext-couchbase/blob/9c1842fd5fd5c3e776ea85d85db1f7d5d5430c11/store.c#L189

        The latter is smart enough to convert 'LONG' keys into strings, whereas the former just blindly complains.

        Show
        mnunberg Mark Nunberg added a comment - So the problem is here: https://github.com/couchbase/php-ext-couchbase/blob/9c1842fd5fd5c3e776ea85d85db1f7d5d5430c11/store.c#L673 Should look something like: https://github.com/couchbase/php-ext-couchbase/blob/9c1842fd5fd5c3e776ea85d85db1f7d5d5430c11/store.c#L189 The latter is smart enough to convert 'LONG' keys into strings, whereas the former just blindly complains.
        Hide
        kneeoh Knee Oh added a comment -

        Additional testing yields that even if I force the key to a string like strval($key); , if the string is purely digits the library will still complain.

        Show
        kneeoh Knee Oh added a comment - Additional testing yields that even if I force the key to a string like strval($key); , if the string is purely digits the library will still complain.
        Hide
        mnunberg Mark Nunberg added a comment -

        http://paste.scsys.co.uk/245952

        I'd submit it to gerrit, but it appears to be down today.

        Show
        mnunberg Mark Nunberg added a comment - http://paste.scsys.co.uk/245952 I'd submit it to gerrit, but it appears to be down today.
        Hide
        trond Trond Norbye added a comment -

        I've already got stuff for this but report in my repo.. it would probably be more efficient to synchronize with the people assigned to the bug reports before doing stuff...

        Show
        trond Trond Norbye added a comment - I've already got stuff for this but report in my repo.. it would probably be more efficient to synchronize with the people assigned to the bug reports before doing stuff...
        Hide
        kneeoh Knee Oh added a comment -

        Is there a patch for this? I just updated to 1.1.5 and am having the same problem with setMulti using a digit based key.

        Show
        kneeoh Knee Oh added a comment - Is there a patch for this? I just updated to 1.1.5 and am having the same problem with setMulti using a digit based key.
        Hide
        jsimon Juan Simon added a comment -

        Extract from http://php.net/manual/en/language.types.array.php

        Strings containing valid integers will be cast to the integer type. E.g. the key "8" will actually be stored under 8. On the other hand "08" will not be cast, as it isn't a valid decimal integer.

        Show
        jsimon Juan Simon added a comment - Extract from http://php.net/manual/en/language.types.array.php Strings containing valid integers will be cast to the integer type. E.g. the key "8" will actually be stored under 8. On the other hand "08" will not be cast, as it isn't a valid decimal integer.

          People

          • Assignee:
            trond Trond Norbye
            Reporter:
            kneeoh Knee Oh
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Gerrit Reviews

              There are no open Gerrit changes