[Pkg-owncloud-commits] [owncloud] 14/66: getData() always needs to return an array, backport of #6988

David Prévot taffit at moszumanska.debian.org
Fri Apr 18 22:49:43 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to annotated tag v5.0.15
in repository owncloud.

commit 5e24e21493299a691f22916a3bd2200bd1142afc
Author: Bjoern Schiessle <schiessle at owncloud.com>
Date:   Mon Feb 10 15:55:47 2014 +0100

    getData() always needs to return an array, backport of #6988
---
 lib/ocs/result.php | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/lib/ocs/result.php b/lib/ocs/result.php
index 8ab378d..8bd51ad 100644
--- a/lib/ocs/result.php
+++ b/lib/ocs/result.php
@@ -29,7 +29,13 @@ class OC_OCS_Result{
 	 * @param $data mixed the data to return
 	 */
 	public function __construct($data=null, $code=100, $message=null) {
-		$this->data = $data;
+		if ($data === null) {
+			$this->data = array();
+		} elseif (!is_array($data)) {
+			$this->data = array($this->data);
+		} else {
+			$this->data = $data;
+		}
 		$this->statusCode = $code;
 		$this->message = $message;
 	}
@@ -49,7 +55,7 @@ class OC_OCS_Result{
 	public function setItemsPerPage(int $items) {
 		$this->perPage = $items;
 	}
-	
+
 	/**
 	 * get the status code
 	 * @return int
@@ -57,7 +63,7 @@ class OC_OCS_Result{
 	public function getStatusCode() {
 		return $this->statusCode;
 	}
-	
+
 	/**
 	 * get the meta data for the result
 	 * @return array
@@ -76,15 +82,15 @@ class OC_OCS_Result{
 		return $meta;
 
 	}
-	
+
 	/**
 	 * get the result data
-	 * @return array|string|int 
+	 * @return array
 	 */
 	public function getData() {
 		return $this->data;
 	}
-	
+
 	/**
 	 * return bool if the method succedded
 	 * @return bool

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list