Description
PHP Couchbase persistent connection shares all option settings (serializer, compression, prefix_key) and keeps that settings across multiple requests. This is not an expected behaviour.
Code:
<?php
$cb1 = new Couchbase("http://192.168.0.180/default");
$cb2 = new Couchbase("http://192.168.0.180/default");
$cb1->setOption(COUCHBASE_OPT_PREFIX_KEY,'cb1');
$cb2->setOption(COUCHBASE_OPT_PREFIX_KEY,'cb2');
$cb1->set('val1','v1', 60);
$cb2->set('val2','v2', 60);
?>
will store following keys:
cb2_val1
cb2_val2
Moreover if you execute right after previous request following code (in another script):
<?php
$cb = new Couchbase("http://192.168.0.180/default");
$cb->set('val3','v3', 60);
?>
the code stores key:
cb2_val3
If you turn off the persistent connections, you will get more consistent results:
cb1_val1
cb2_val2
val3
The problem is that whole _php_couchbase_res structure is shared when using persistent connection. Possible change is to duplicate this structure in php_couchbase_create_impl. But resource destructors should be modified according to this change.