From ec481f73487a9229350eeb7526851b05dd45319c Mon Sep 17 00:00:00 2001
From: Thijs Kinkhorst <thijs@kinkhorst.com>
Date: Tue, 22 Jul 2014 17:42:56 +0200
Subject: [PATCH] Throw an error when downloading remote module definition
 fails.

---
 modules/core/lib/ModuleDefinition.php | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/modules/core/lib/ModuleDefinition.php b/modules/core/lib/ModuleDefinition.php
index 5603c9002..64106e628 100644
--- a/modules/core/lib/ModuleDefinition.php
+++ b/modules/core/lib/ModuleDefinition.php
@@ -2,7 +2,7 @@
 
 
 /**
- * Represents a definitino of a module.
+ * Represents a definition of a module.
  * Is usually read and parsed from a JSON definition file.
  *
  * @Author	Andreas Ă…kre Solberg, <andreas.solberg@uninett.no>
@@ -43,6 +43,9 @@ class sspmod_core_ModuleDefinition {
 			
 		} elseif(preg_match('|^http(s)?://.*$|', $id)) {
 			$defraw = file_get_contents($id);
+			if ( $defraw === FALSE ) {
+				throw new Exception('Error while downloading module definition [' . $id . ']');
+			}
 			$def = json_decode($defraw, TRUE);
 		} else {
 			throw new Exception('Could not resolve [' . $id . '] as URL nor module identifier.');
-- 
GitLab