LCB_EINVAL_MCD upon document unlock()

All I am doing is write locking the document using “getAndLock()” then later in the function I am using “unlock()” to unlock it, “unlock()” errors as shown below.

Couchbase\Exception: LCB_EINVAL_MCD: A badly formatted packet was sent to the server. Please report this in a bug in file…

    // -- Instantiating a new CouchbaseConnection class.
    $connection = new CouchbaseConnect;

    // -- Grabbing the bucket.
    $bucket = $connection->main($patch['bucket_id']);

    // -- Grabbing and locking the document (1 second).
    $document = $bucket->getAndLock($request['document_id'], 1);

    $bucket->unlock($request['document_id']);

    // -- Patching the couchbase document.
    $bucket->replace($patch['document_id'], $patched_values);

While it looks like there is a bug there in that a malformed request is going out, note that unlock requires the CAS from the getAndLock() to be supplied in the unlock(). This is mentioned in the API reference. The document_id alone is insufficient, as the CAS uniquely identifies who locked the item.

which versions do you have in use? it’d be great if you can file an issue at issues.couchbase.com.

Thanks for the quick response, I will try using the CAS again.
I am running the following:

Couchbase Server:
Enterprise Edition 5.5.1 build 3511
Couchbase PHP SDK: 1.0.6
Laravel: 5.8.23
Laravel Host (development): Ubuntu 18.0.4