moan0s / ILMO

Intelligent Library Management Online - A simple Web-App for the organization of a library, the users, books, opening hours and lendings.
https://www.fs-medtech.de/bib/
GNU General Public License v3.0
1 stars 1 forks source link

Saving settings destroys json file #82

Closed Sebastian1515 closed 3 years ago

Sebastian1515 commented 3 years ago

Saving the settings sets some settings to null and destroys the format of the json file.

moan0s commented 3 years ago

The settings should in the long term be set via web and not by manual editing. Therfore I would not consider the change of formatting as a bug. Most text editors should be able to reformat json to a more human readable file. Maybe there is a solution to keep the format, but I don't know one. I will add a fix that should help at least. Setting settings to null is a bug I will look into.

Sebastian1515 commented 3 years ago

Does not fix the problem. Causes error: Warning: Trying to access array offset on value of type null in C:\xampp\htdocs\ILMO\class\lang.php on line 3 Warning: Trying to access array offset on value of type null in C:\xampp\htdocs\ILMO\class\lang.php on line 36 Fatal error: Uncaught TypeError: array_merge(): Argument #2 must be of type array, null given in C:\xampp\htdocs\ILMO\class\lang.php:36 Stack trace: #0 C:\xampp\htdocs\ILMO\class\lang.php(36): array_merge(Array, NULL) #1 C:\xampp\htdocs\ILMO\class\data.php(15): Lang->set_language('german') #2 C:\xampp\htdocs\ILMO\index.php(19): Data->__construct(Object(Lang)) #3 {main} thrown in C:\xampp\htdocs\ILMO\class\lang.php on line 36

moan0s commented 3 years ago

Can you include steps to reproduce the error? Possibly the settings file is invalid json and therfore throws an error. Edit: Found it myself, fixed

Sebastian1515 commented 3 years ago

Some fields still set to null.

{"default_language":"german",
"lang":{"english":{"OPENING_TIMES_INFO":null}
,
"german":{"OPENING_TIMES_INFO":null}
}
,
"log_mail":null,
"mail_reminder_interval":"0",
"max_loan_time":null,
"minimum_pw_length":null,
"minimum_token_hours":null,
"opening_days":["monday",
"tuesday",
"wednesday",
"thursday",
"friday"],
"path_mail_log":null,
"timezone":null,
"version":"1.3"}
moan0s commented 3 years ago

Thanks. I will have a look after my vacation. Probably a bit more complicated, settings is not finished and full of bugs rn 🙈

moan0s commented 3 years ago

Fixed the save of settings (kinda) by improving output. Could still use some improvements, but I would not consider it a big anymore. All setting bugs can be collected in #83 Closing