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

Validate constants provided with --extra-php to avoid PHP notices #148

Open
ecotechie opened this issue Nov 13, 2022 · 1 comment
Open

Comments

@ecotechie
Copy link

The example on the wp config create command's page has an issue. When I create a config like this:

wp config create --dbname=testing --dbuser=wp --dbpass=securepswd --extra-php <<PHP
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
PHP

It adds the debug true, not seeing that by default debug false is already set. This creates warnings on every consecutive run of wp and also adds these to the log.

When doing wp config set WP_DEBUG true --raw instead, it changes the existing false setting to true, or creates it...

Should we be checking for these constants when adding them with --extra-php?

@ecotechie ecotechie changed the title Using --extra-php does not validate/update contant Using --extra-php does not validate/update constant Nov 13, 2022
@danielbachhuber
Copy link
Member

Should we be checking for these constants when adding them with --extra-php?

@ecotechie Interesting idea! I'm not sure how this would be technically possible, but I'm open to a pull request for it.

An alternative approach to consider: offer some explicit wp config create argument for setting a constant's value, and use WPConfigTransformer to manipulate the wp-config.php file.

@danielbachhuber danielbachhuber changed the title Using --extra-php does not validate/update constant Validate constants provided with --extra-php to avoid PHP notices Nov 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants