[2.0.3] get() fails to return an empty string correctly



when trying to retrieve an empty value get() returns a result similair to key not found instead of an empty string (as was the case in the library v1).

Sample code to reproduce :

$cluster = new CouchbaseCluster('....','test','');
$bucket = $cluster->openBucket('test');


Result :

object(CouchbaseMetaDoc)#4 (4) {
  resource(5) of type (CouchbaseCAS)

Expected result : having “value” containing “” (empty string) instead of null.
The decoder function is not called.

My guess is that the code in transcoding.c, in function pcbc_bytes_to_zval :

	if (nbytes == 0) {
		return SUCCESS;

short-circuits the standard zval creation process.

In the previous library version (1.1.2) the library returned an empty string as expected.

Would it be possible to revert to this previous behaviour ?

Tested on the master branch (rev 3b71531b4d7203707067ab8f6bfdfd11bfadb1e5).


Hey excession,

You are correct that a 0-length string stored should return a blank string rather than null. Here is a ticket for this issue: https://issues.couchbase.com/browse/PCBC-326.

Cheers, Brett