Skip to content
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

Don't add WP_DEBUG=TRUE if WORDPRESS_DEBUG is set to FALSE #496

Closed
dbjpanda opened this issue May 14, 2020 · 5 comments · Fixed by #557
Closed

Don't add WP_DEBUG=TRUE if WORDPRESS_DEBUG is set to FALSE #496

dbjpanda opened this issue May 14, 2020 · 5 comments · Fixed by #557
Labels
Request Request for image modification or feature

Comments

@dbjpanda
Copy link

I have a .env.example inside my docker-compose project. For simplicity, when onboarding a team member, I just ask to rename it to .env, change the debug value if you are developer, and docker-compose up.

If you are a designer you don't need to change that value. Just keep its value as it is. i.e By default I have the env variable set to FALSE. But even if it is set to false it adds WP_DEBUG=true.

So please don't check with an empty variable. Rather it should be checked if it is set to true or not

if [ "$WORDPRESS_DEBUG" ]; then

@wglambert wglambert added the Request Request for image modification or feature label May 14, 2020
@yosifkit
Copy link
Member

-e WORDPRESS_DEBUG=1 (defaults to disabled, non-empty value will enable WP_DEBUG in wp-config.php)

Docker Hub docs

For simplicity of our bash scripts across many official-images, we don't look for "truthy" values and instead just use the fact of it being filled/set to turn it on and unset/empty to turn if off.

@dbjpanda
Copy link
Author

@yosifkit Thanks for a quick response.
Okay, I understand that. But here you are populating a PHP variable. A PHP variable is empty doesn't mean it is false. Contains some value does not mean it is true always.

Though it is okay for those who spin the container directly. But doesn't fit with Docker-compose or .env file.

@tianon
Copy link
Member

tianon commented May 14, 2020

But here you are populating a PHP variable.

I think this is the crux of the disagreement here -- our WORDPRESS_DEBUG environment variable is not populating WP_DEBUG, but rather toggling whether or not we set it (so that in a default Wordpress install, it is not explicitly set/touched by our script at all).

Frankly, I'd love to deprecate it entirely in favor of the newer and much more flexible WORDPRESS_CONFIG_EXTRA, which could be set to something clever like the following to accomplish what you're looking for:

        WORDPRESS_CONFIG_EXTRA: |
          define('WP_DEBUG', boolval(getenv('WP_DEBUG')));

@dbjpanda
Copy link
Author

Frankly, I'd love to deprecate it entirely in favor of the newer and much more flexible WORDPRESS_CONFIG_EXTRA, which could be set to something clever like the following to accomplish what you're looking for:

@tianon I agree with your point completely. WORDPRESS_DEBUG should be removed. @yosifkit please let us know if you are willing to merge a PR.

Thanks

@rfrenayworldstream
Copy link

Hi,

I agree that setting this value with any value should enable WP_DEBUG according the documentation. However unsetting this variable will not turn off debugging again.

The following change would allow us to turn off debugging.

if [ "$WORDPRESS_DEBUG" ]; then
        set_config 'WP_DEBUG' 1 boolean
else
        set_config 'WP_DEBUG' 0 boolean
fi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Request Request for image modification or feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants