From 85eb99df03a03249d9243cb81acfe43599f248b1 Mon Sep 17 00:00:00 2001 From: "Brandon Casey(Work)" Date: Fri, 28 Mar 2014 16:49:36 -0400 Subject: [PATCH] Added Error Handling for invalid JSOn --- libs/functions.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libs/functions.php b/libs/functions.php index c65fafc..d04afdb 100644 --- a/libs/functions.php +++ b/libs/functions.php @@ -37,6 +37,10 @@ if (substr($config_file, 0, 1) !== '/') $config_file = $base . '/' . $config_file; if (file_exists($config_file)) { $config = json_decode(file_get_contents($config_file), true); + if(!isset($config)) { + echo 'Daux.io Config Error:
The config file ' . $config_file . ' that was passed contained invalid JSON. Learn More.'; + exit; + } $options = array_merge($options, $config); } if (!isset($options['ignore']['files'])) $options['ignore']['files'] = array(); @@ -54,7 +58,7 @@ exit; } } - if (!ini_get('date.timezone')) date_default_timezone_set('GMT'); + if (!ini_get('date.timezone')) date_default_timezone_set('GMT'); return $options; }