Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

try to make couchdb adapter more compatible #1340

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 20 additions & 4 deletions data/source/http/adapter/CouchDb.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,25 @@ public function configureClass($class) {
* @param array $params
* @return mixed
*/
public function __call($method, $params = []) {
list($path, $data, $options) = ($params + ['/', [], []]);
return json_decode($this->connection->{$method}($path, $data, $options));

public function __call($method, $params = array()) {
list($path, $data, $options) = ($params + array('/', array(), array()));
$result = $this->connection->{$method}($path, $data, $options);
if (is_array($result)) {
return (object) $result;
}
else if (is_string($result)){
return json_decode($result);
}
else {
$message = "CouchDB connection returns datatype : ".gettype($result)." . ";
$message .= 'We are unable to handle that.';
trigger_error($message, E_USER_ERROR);


}


}

/**
Expand Down Expand Up @@ -533,4 +549,4 @@ protected function _format(array $data) {

}

?>
?>
3 changes: 2 additions & 1 deletion storage/cache/adapter/Apc.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
$message .= 'bootstrap directory to the most recent version or remove the line where ';
$message .= 'this file was originally included. ';
$message .= 'See https://git.io/voxgh for the most recent version.';

trigger_error($message, E_USER_DEPRECATED);

require_once LITHIUM_LIBRARY_PATH . '/lithium/storage/cache/Adapter.php';
Expand Down Expand Up @@ -194,4 +195,4 @@ public static function enabled() {
}
}

?>
?>