-
-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
YOURLS does wrong comparisons for the configuration #21
Comments
Thanks for this report, @nymous! |
I didn't change the Environment variables are respected, but they are retrieved as strings, which in YOURLS code are compared to a boolean. In PHP, the string My patch forces YOURLS to convert the constant value to the corresponding boolean, whether this value is already a boolean or a string. That being said, maybe this isn't YOURLS responsibility to handle this better, maybe the maintainers from the Docker image should patch it, as it works if the config file is edited manually to enter a boolean value... |
Wait, did I really create this issue in the Docker repository? Woops, it was supposed to go to the YOURLS source repository, sorry! 😅 |
No, I moved it, the issue does not target YOURLS itself but its usage inside the docker image.
OK, got it now. |
Oh, right. Thought I lost my mind for a second ^^ Well, adding this filter in the config file seems like a better idea. Not sure if there is any other variable that would be affected by the same issue. |
Agreed. I think this is the case for all boolean variables. |
Describe the bug
YOURLS does not take into account the configuration values for
YOURLS_UNIQUE_URLS
andYOURLS_PRIVATE
when passed as environment variables.To Reproduce
When running the official Docker image for YOURLS (https://hub.docker.com/_/yourls), configuration is passed as environment variables.
Setting the env variable
YOURLS_UNIQUE_URLS
to false results in the PHP constantYOURLS_UNIQUE_URLS
to be set to the string"false"
, which results in an incorrect comparison in theyourls_allow_duplicate_longurls
function (YOURLS_UNIQUE_URLS == false
returnsfalse
, as any not-empty not-"0"
string is truthy).The same problem happens for the
YOURLS_PRIVATE
constant and theyourls_is_private
function (and maybe for others, I haven't checked).I have worked around the issue with the following patch (works against the tag 1.7.3):
Environment (please complete the following information):
The text was updated successfully, but these errors were encountered: