X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=application%2Fconfig%2FConfigJson.php;h=30007eb4cfd550fc106d7ace97fca00545519cff;hb=7af9a41881ed0b9d44d18a0ce03a123a8441adf5;hp=94693c860c5f89a1e72fb0bc79d43d70b906cd4b;hpb=da10377b3c263d96a46cf9101c202554343d2cd0;p=github%2Fshaarli%2FShaarli.git diff --git a/application/config/ConfigJson.php b/application/config/ConfigJson.php index 94693c86..30007eb4 100644 --- a/application/config/ConfigJson.php +++ b/application/config/ConfigJson.php @@ -17,10 +17,11 @@ class ConfigJson implements ConfigIO } $data = file_get_contents($filepath); $data = str_replace(self::getPhpHeaders(), '', $data); + $data = str_replace(self::getPhpSuffix(), '', $data); $data = json_decode($data, true); if ($data === null) { $error = json_last_error(); - throw new Exception('An error occured while parsing JSON file: error code #'. $error); + throw new Exception('An error occurred while parsing JSON file: error code #'. $error); } return $data; } @@ -32,7 +33,7 @@ class ConfigJson implements ConfigIO { // JSON_PRETTY_PRINT is available from PHP 5.4. $print = defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : 0; - $data = self::getPhpHeaders() . json_encode($conf, $print); + $data = self::getPhpHeaders() . json_encode($conf, $print) . self::getPhpSuffix(); if (!file_put_contents($filepath, $data)) { throw new IOException( $filepath, @@ -62,4 +63,16 @@ class ConfigJson implements ConfigIO { return ''; + } }