[Bug] SERVER_LONG_DESCRIPTION config option is incorrectly parsed as an array of strings in Docker #12

Closed
opened 2024-04-24 21:31:12 +00:00 by 2bitexclusion · 1 comment

Assuming I've got it correct, this bug was introduced with e31b9494af with this code:

if(gettype($from_config[$key]) != gettype($val) && !is_numeric($val)) {
(gen_config.php line 68)

Basically, when setting FOURGET_SERVER_LONG_DESCRIPTION in Docker, gen_config.php will incorrectly parse this environment variable (a string) into an array of strings.

I believe this happens because in the default configuration, SERVER_LONG_DESCRIPTION is set to null, so it assumes the env variable needs to be parsed due to a type mismatch check (null vs string). I'm not a PHP expert though so I'm just guessing here.

A simple workaround would be to just change the default config, so that SERVER_LONG_DESCRIPTION is some generic example string, much like SERVER_SHORT_DESCRIPTION.

Something similar is likely happening to MARGINALIA_API_KEY, but I don't use that at all so I can't double check.

Assuming I've got it correct, this bug was introduced with e31b9494af16bf833d14b6256ca055fa94b6f77b with this code: `if(gettype($from_config[$key]) != gettype($val) && !is_numeric($val)) {` (gen_config.php line 68) Basically, when setting `FOURGET_SERVER_LONG_DESCRIPTION` in Docker, gen_config.php will incorrectly parse this environment variable (a string) into an array of strings. I believe this happens because in the default configuration, `SERVER_LONG_DESCRIPTION` is set to `null`, so it assumes the env variable needs to be parsed due to a type mismatch check (null vs string). I'm not a PHP expert though so I'm just guessing here. A simple workaround would be to just change the default config, so that `SERVER_LONG_DESCRIPTION` is some generic example string, much like `SERVER_SHORT_DESCRIPTION`. Something similar is likely happening to `MARGINALIA_API_KEY`, but I don't use that at all so I can't double check.
Owner

throwaway should've fixed it, thank you for your time

throwaway should've fixed it, thank you for your time
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: lolcat/4get#12
No description provided.