aboutsummaryrefslogtreecommitdiff
path: root/lib/Minz/Configuration.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2019-01-06 12:19:26 +0100
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2019-01-06 12:19:26 +0100
commita26eff8a2084a779959f5bef96a4bc72c7ec6ab7 (patch)
tree03e7f8ebef3fcfc67018e19034fbbb841d9dc6bf /lib/Minz/Configuration.php
parent30327efecd4fa7f4131cd0d7a5ac80b460af95d1 (diff)
parent15d74d934708896706278574af159a9dcb3a4313 (diff)
Merge branch 'FreshRSS/dev' into FreshRSS/dev-1.14.0
Diffstat (limited to 'lib/Minz/Configuration.php')
-rw-r--r--lib/Minz/Configuration.php17
1 files changed, 5 insertions, 12 deletions
diff --git a/lib/Minz/Configuration.php b/lib/Minz/Configuration.php
index 3e486d68e..aae3accc6 100644
--- a/lib/Minz/Configuration.php
+++ b/lib/Minz/Configuration.php
@@ -27,23 +27,16 @@ class Minz_Configuration {
/**
* Parse a file and return its data.
*
- * If the file does not contain a valid PHP code returning an array, an
- * empty array is returned anyway.
- *
* @param $filename the name of the file to parse.
* @return an array of values
- * @throws Minz_FileNotExistException if the file does not exist.
+ * @throws Minz_FileNotExistException if the file does not exist or is invalid.
*/
public static function load($filename) {
- if (!file_exists($filename)) {
- throw new Minz_FileNotExistException($filename);
- }
-
- $data = include($filename);
+ $data = @include($filename);
if (is_array($data)) {
return $data;
} else {
- return array();
+ throw new Minz_FileNotExistException($filename);
}
}
@@ -117,7 +110,7 @@ class Minz_Configuration {
$this->default_filename = $default_filename;
$this->_configurationSetter($configuration_setter);
- if (!is_null($this->default_filename)) {
+ if ($this->default_filename != null) {
$this->data = self::load($this->default_filename);
}
@@ -126,7 +119,7 @@ class Minz_Configuration {
$this->data, self::load($this->config_filename)
);
} catch (Minz_FileNotExistException $e) {
- if (is_null($this->default_filename)) {
+ if ($this->default_filename == null) {
throw $e;
}
}