Uploaded image for project: 'Couchbase PHP client library'
  1. Couchbase PHP client library
  2. PCBC-955

CAS parser should reject values with trailing garbage

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 4.1.6
    • 4.1.5
    • extension
    • None
    • 1
    • SDK40

    Description

      When deleting a document with an invalid CAS option passed in, the document shouldn't be deleted in v4.1.5; instead, it should throw out an exception.

       

      Code to reproduce:

      $options = new Couchbase\ClusterOptions();
      $options->credentials('username', 'password');
      $cluster = new Couchbase\Cluster('couchbase://couchbase7.1', $options);
       
      $collection = $cluster->bucket('test')->defaultCollection();
       
      $key = 'key';
      $collection->upsert($key, [$key => $key]);
      $doc = $collection->get($key);
      // The output is:
      //     Array
      //     (
      //         [key] => key
      //     )
      echo print_r($doc->content(), true), PHP_EOL;
      echo $doc->cas(), PHP_EOL;
       
      // An invalid cas value is used here.
      $options = Couchbase\RemoveOptions::build()->cas($doc->cas() . '-invalid');
      $collection->remove($key, $options);
      // The output should still be:
      //     Array
      //     (
      //         [key] => key
      //     )
      try {
          print_r($collection->get($key)->content());
      } catch (Couchbase\Exception\DocumentNotFoundException $e) {
          echo "This shouldn't be printed out.", PHP_EOL;
      } 

       

       

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            avsej Sergey Avseyev
            deminy Demin Yin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty