From ee3da7b09625b5caefffa701afe21f08ce89c110 Mon Sep 17 00:00:00 2001 From: alexanderhaensch Date: Thu, 30 Jun 2016 11:30:00 +0200 Subject: [PATCH 1/5] Clarify error message Best would be to include a link to https://github.com/UnionOfRAD/framework here --- storage/cache/adapter/Apc.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/storage/cache/adapter/Apc.php b/storage/cache/adapter/Apc.php index 4907f3396a..b7458b2932 100644 --- a/storage/cache/adapter/Apc.php +++ b/storage/cache/adapter/Apc.php @@ -12,8 +12,8 @@ $message = 'The file (`' . __FILE__ . '`) has probably been included directly within '; $message .= 'the bootstrap process. Due to its dependencies it should be (auto-)loaded '; $message .= 'i.e. through the `Libraries` class exclusively. Please update your app\'s '; - $message .= 'bootstrap to the most recent version or remove the line where this file was '; - $message .= 'originally included.'; + $message .= 'bootstrap directory to the most recent version or remove the line where '; + $message .= 'this file was originally included.'; trigger_error($message, E_USER_DEPRECATED); require_once LITHIUM_LIBRARY_PATH . '/lithium/storage/cache/Adapter.php'; @@ -192,4 +192,4 @@ public static function enabled() { } } -?> \ No newline at end of file +?> From 23b11cc0cd15a0b8654820576fb29086aba83dfc Mon Sep 17 00:00:00 2001 From: alexanderhaensch Date: Fri, 8 Feb 2019 08:56:01 +0000 Subject: [PATCH 2/5] Fix for couchdb 2.3 response Couchdb 2.3 returns Content-Type: application/json instead of Content-Type: text/plain; charset=utf-8 in couchdb 1.x li3 handles the response correctly but the couchdb driver tries to json_decode a second time. --- data/source/http/adapter/CouchDb.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/data/source/http/adapter/CouchDb.php b/data/source/http/adapter/CouchDb.php index b03007cf3f..7ed093122f 100644 --- a/data/source/http/adapter/CouchDb.php +++ b/data/source/http/adapter/CouchDb.php @@ -117,7 +117,13 @@ public function configureClass($class) { */ public function __call($method, $params = array()) { list($path, $data, $options) = ($params + array('/', array(), array())); - return json_decode($this->connection->{$method}($path, $data, $options)); + $result = $this->connection->{$method}($path, $data, $options); + if (is_array($result)) { + return($result); + } + else{ + return json_decode($result); + } } /** @@ -529,4 +535,4 @@ protected function _format(array $data) { } -?> \ No newline at end of file +?> From 338818d80539b987e879c2301eaf0af4282bdf66 Mon Sep 17 00:00:00 2001 From: alexanderhaensch Date: Fri, 8 Feb 2019 09:31:06 +0000 Subject: [PATCH 3/5] ensure to return object type --- data/source/http/adapter/CouchDb.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/source/http/adapter/CouchDb.php b/data/source/http/adapter/CouchDb.php index 7ed093122f..4e73d5619a 100644 --- a/data/source/http/adapter/CouchDb.php +++ b/data/source/http/adapter/CouchDb.php @@ -119,7 +119,7 @@ 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($result); + return (object) $result; } else{ return json_decode($result); From 85ed574038fc435b4f010b9a4201d640dc665fb1 Mon Sep 17 00:00:00 2001 From: alexanderhaensch Date: Fri, 8 Feb 2019 09:51:53 +0000 Subject: [PATCH 4/5] cover other cases with errormessage --- data/source/http/adapter/CouchDb.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/data/source/http/adapter/CouchDb.php b/data/source/http/adapter/CouchDb.php index 4e73d5619a..58d6667f46 100644 --- a/data/source/http/adapter/CouchDb.php +++ b/data/source/http/adapter/CouchDb.php @@ -121,9 +121,17 @@ public function __call($method, $params = array()) { if (is_array($result)) { return (object) $result; } - else{ + 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); + + + } + } /** From 8a85b2401feea8cc69283467c1da59535e37576f Mon Sep 17 00:00:00 2001 From: alexanderhaensch Date: Fri, 8 Feb 2019 09:54:19 +0000 Subject: [PATCH 5/5] Update CouchDb.php