Coder Social home page Coder Social logo

Comments (6)

LeoColomb avatar LeoColomb commented on August 30, 2024

Thanks for this report, @nymous!
What is your config.php?
Instead of editing core file, you should prefer using the config file.
The one distributed with the Docker image is written to respect environnement variables.

https://github.com/YOURLS/docker-yourls/blob/d076c5dbc3d1641e855765c3410490e710b19b6f/config-docker.php#L43-L51

from images.

nymous avatar nymous commented on August 30, 2024

I didn't change the config.php from the Docker image, that isn't the issue here.

Environment variables are respected, but they are retrieved as strings, which in YOURLS code are compared to a boolean. In PHP, the string "false" is truthy.

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...

from images.

nymous avatar nymous commented on August 30, 2024

Wait, did I really create this issue in the Docker repository? Woops, it was supposed to go to the YOURLS source repository, sorry! 😅

from images.

LeoColomb avatar LeoColomb commented on August 30, 2024

Wait, did I really create this issue in the Docker repository?

No, I moved it, the issue does not target YOURLS itself but its usage inside the docker image.

Environment variables are respected, but they are retrieved as strings, which in YOURLS code are compared to a boolean. In PHP, the string "false" is truthy

OK, got it now.
What about fixing this on the PHP constants in the config.php directly?

from images.

nymous avatar nymous commented on August 30, 2024

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.

from images.

LeoColomb avatar LeoColomb commented on August 30, 2024

Agreed. I think this is the case for all boolean variables.
Would you aim opening a pull request with the fix? 👍

from images.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.