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.
This commit is contained in:
parent
820cae27cf
commit
42a72c02fa
1 changed files with 2 additions and 2 deletions
|
@ -73,7 +73,7 @@ class ConfigJson implements ConfigIO
|
|||
*/
|
||||
public static function getPhpHeaders()
|
||||
{
|
||||
return '<?php /*'. PHP_EOL;
|
||||
return '<?php /*'. "\n";
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -85,6 +85,6 @@ class ConfigJson implements ConfigIO
|
|||
*/
|
||||
public static function getPhpSuffix()
|
||||
{
|
||||
return PHP_EOL . '*/ ?>';
|
||||
return "\n" . '*/ ?>';
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue