moay / loxberry-php-core

The LoxBerry system library for PHP interactions.
MIT License
0 stars 1 forks source link

Exception when loading a general.cfg that has a '!' as value #1

Open romanlum opened 3 years ago

romanlum commented 3 years ago

When a gerneral.cfg is loaded and has a '!' in one of the values this exception occurs:

PHP Warning: syntax error, unexpected '!' in /opt/loxberry/config/system/general.cfg on line 54
in /opt/loxberry/data/plugins/unifi/vendor/moay/config_lite/Config/Lite.php on line 131
Warning: syntax error, unexpected '!' in /opt/loxberry/config/system/general.cfg on line 54
in /opt/loxberry/data/plugins/unifi/vendor/moay/config_lite/Config/Lite.php on line 131
PHP Fatal error: Uncaught Config_Lite_Exception_Runtime: failure, can not parse the file: /opt/loxberry/config/system/general.cfg in /opt/loxberry/data/plugins/unifi/vendor/moay/config_lite/Config/Lite.php:133

The problem is that the string values are not quoted in the loxberry general.cfg and it is likely that the miniserver password contains a '!'.

[MINISERVER1]
PASS=test12345!

One fix would be to use INI_SCANNER_RAW when constructing the Config_Lite object. $this->config = new \Config_Lite($fileName, null, INI_SCANNER_RAW);

If this fix would be ok for you i can create a pull request.

thx

moay commented 3 years ago

Sounds good, feel free to submit a pr.

Also keep in mind that LoxBerry Poppins isn't actively maintained, I switched away from LoxBerry soon after realizing that the current implementation would need to be integrated in the core very deeply to be stable for the future and that node red gives me everything I need with way less effort. :)