aboutsummaryrefslogtreecommitdiffhomepage
path: root/application/config
diff options
context:
space:
mode:
authorGanesh Kandu <kanduganesh@gmail.com>2020-10-27 17:42:35 +0530
committerGitHub <noreply@github.com>2020-10-27 17:42:35 +0530
commit42a72c02fa4b6a5eb9d26a7a3a990e497fc10df3 (patch)
treed8002631123dcb97067a60661472675013f89a67 /application/config
parent820cae27cfcc94af552818f3f1e5342e00478f6c (diff)
downloadShaarli-42a72c02fa4b6a5eb9d26a7a3a990e497fc10df3.tar.gz
Shaarli-42a72c02fa4b6a5eb9d26a7a3a990e497fc10df3.tar.zst
Shaarli-42a72c02fa4b6a5eb9d26a7a3a990e497fc10df3.zip
Replaced PHP_EOL to "\n"
i was getting error ``` An error occurred while parsing JSON configuration file (data/config.json.php): error code #4 ➜ Syntax error Please check your JSON syntax (without PHP comment tags) using a JSON lint tool such as jsonlint.com. ``` after debug i found ```php $data = str_replace(self::getPhpHeaders(), '', $data); $data = str_replace(self::getPhpSuffix(), '', $data); ``` doesn't removing php header and php suffix cause of this issue was PHP_EOL represents the endline character for the current system. if my ```config.json.php``` was encoded with unix ( LF ) and php running on windows windows encoding ( CR LF ) is not same as unix encoding ( LF ) so ```str_replace``` doesn't replace strin then it causes issue.
Diffstat (limited to 'application/config')
-rw-r--r--application/config/ConfigJson.php4
1 files changed, 2 insertions, 2 deletions
diff --git a/application/config/ConfigJson.php b/application/config/ConfigJson.php
index c0c0dab9..eaa4ee3f 100644
--- a/application/config/ConfigJson.php
+++ b/application/config/ConfigJson.php
@@ -73,7 +73,7 @@ class ConfigJson implements ConfigIO
73 */ 73 */
74 public static function getPhpHeaders() 74 public static function getPhpHeaders()
75 { 75 {
76 return '<?php /*'. PHP_EOL; 76 return '<?php /*'. "\n";
77 } 77 }
78 78
79 /** 79 /**
@@ -85,6 +85,6 @@ class ConfigJson implements ConfigIO
85 */ 85 */
86 public static function getPhpSuffix() 86 public static function getPhpSuffix()
87 { 87 {
88 return PHP_EOL . '*/ ?>'; 88 return "\n" . '*/ ?>';
89 } 89 }
90} 90}