summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2014-08-01 15:51:11 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2014-08-01 15:51:11 +0200
commit8e6409a932c9f79901f22500b852372be9b650fd (patch)
tree3928e0a856e6de06f605feaf680997c848d59470
parent4886c8582d1956b4958226f5da2c5fe8d6693ff9 (diff)
parenta0ab4c243441a5ca2fee94d826955b1cb0bec1e1 (diff)
downloadnextcloud-server-8e6409a932c9f79901f22500b852372be9b650fd.tar.gz
nextcloud-server-8e6409a932c9f79901f22500b852372be9b650fd.zip
Merge pull request #10098 from owncloud/fix-10094-master
prevent PHP errors and enhance logging
-rw-r--r--lib/private/ocsclient.php18
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/private/ocsclient.php b/lib/private/ocsclient.php
index dc52fc27b5e..e4cce6b2260 100644
--- a/lib/private/ocsclient.php
+++ b/lib/private/ocsclient.php
@@ -59,7 +59,7 @@ class OC_OCSClient{
/**
* Get all the categories from the OCS server
- * @return array an array of category ids
+ * @return array|null an array of category ids or null
* @note returns NULL if config value appstoreenabled is set to false
* This function returns a list of all the application categories on the OCS server
*/
@@ -92,7 +92,7 @@ class OC_OCSClient{
/**
* Get all the applications from the OCS server
- * @return array an array of application data
+ * @return array|null an array of application data or null
*
* This function returns a list of all the applications on the OCS server
* @param array|string $categories
@@ -150,9 +150,9 @@ class OC_OCSClient{
/**
* Get an the applications from the OCS server
* @param string $id
- * @return array an array of application data
+ * @return array|null an array of application data or null
*
- * This function returns an applications from the OCS server
+ * This function returns an applications from the OCS server
*/
public static function getApplication($id) {
if(OC_Config::getValue('appstoreenabled', true)==false) {
@@ -162,7 +162,7 @@ class OC_OCSClient{
$xml=OC_OCSClient::getOCSresponse($url);
if($xml==false) {
- OC_Log::write('core', 'Unable to parse OCS content', OC_Log::FATAL);
+ OC_Log::write('core', 'Unable to parse OCS content for app ' . $id, OC_Log::FATAL);
return null;
}
$loadEntities = libxml_disable_entity_loader(true);
@@ -170,6 +170,10 @@ class OC_OCSClient{
libxml_disable_entity_loader($loadEntities);
$tmp=$data->data->content;
+ if (is_null($tmp)) {
+ OC_Log::write('core', 'Invalid OCS content returned for app ' . $id, OC_Log::FATAL);
+ return null;
+ }
$app=array();
$app['id']=$tmp->id;
$app['name']=$tmp->name;
@@ -192,7 +196,7 @@ class OC_OCSClient{
/**
* Get the download url for an application from the OCS server
- * @return array an array of application data
+ * @return array|null an array of application data or null
*
* This function returns an download url for an applications from the OCS server
* @param string $id
@@ -223,6 +227,4 @@ class OC_OCSClient{
return $app;
}
-
-
}