Details
Description
I just discovered this while fixing a bug in Basement.
The $cas variable callback is not working on get() but works on getMulti().
Simple example:
Works:
$client->set("foo", "bar");
$cas = null;
var_dump($client->getMulti(array("foo"), $cas));
var_dump($cas);
array(1) {
["foo"]=>
string(3) "bar"
}
array(1) {
["foo"]=>
string(20) "11699665754086047744"
}
Doesn't work:
$client->set("foo", "bar");
$cas = null;
var_dump($client->get("foo", $cas));
var_dump($cas);
string(3) "bar"
NULL
The doc gets returned properly, but the cas value is not set. Also, when you set $cas to "" or false (not null), then it complains with a dubios error:
Warning: Couchbase::get() expects parameter 2 to be a valid callback, no array or string given in /Users/michael/Webserver/basement-test/index.php on line 10
Note that its a warning and not an exception on the OOP interface!
The $cas variable callback is not working on get() but works on getMulti().
Simple example:
Works:
$client->set("foo", "bar");
$cas = null;
var_dump($client->getMulti(array("foo"), $cas));
var_dump($cas);
array(1) {
["foo"]=>
string(3) "bar"
}
array(1) {
["foo"]=>
string(20) "11699665754086047744"
}
Doesn't work:
$client->set("foo", "bar");
$cas = null;
var_dump($client->get("foo", $cas));
var_dump($cas);
string(3) "bar"
NULL
The doc gets returned properly, but the cas value is not set. Also, when you set $cas to "" or false (not null), then it complains with a dubios error:
Warning: Couchbase::get() expects parameter 2 to be a valid callback, no array or string given in /Users/michael/Webserver/basement-test/index.php on line 10
Note that its a warning and not an exception on the OOP interface!
Activity
Michael Nitschinger
made changes -
| Field | Original Value | New Value |
|---|---|---|
| Priority | Critical [ 2 ] | Major [ 3 ] |
| Component/s | docs [ 10135 ] | |
| Component/s | library [ 10134 ] |
Matt Ingenthron
made changes -
| Assignee | Matt Ingenthron [ ingenthr ] | Trond Norbye [ trond ] |
Matt Ingenthron
made changes -
| Fix Version/s | 1.1.3 [ 10452 ] |
Trond Norbye
made changes -
| Status | Open [ 1 ] | In Progress [ 3 ] |
Trond Norbye
made changes -
| Summary | $cas callback not working on get() | The documentation is wrong for get() in couchbase-api.php |
Trond Norbye
made changes -
| Status | In Progress [ 3 ] | Resolved [ 5 ] |
| Resolution | Fixed [ 1 ] |
get(key, callback, cas)
then only the documentation needs to be updated here:
https://github.com/couchbase/php-ext-couchbase/blob/master/example/couchbase-api.php#L320