Varying-Vagrant-Vagrants / VVV

An open source Vagrant configuration for developing with WordPress
https://varyingvagrantvagrants.org
MIT License
4.54k stars 847 forks source link

Bug: Duplicate WP_DEBUG definition #2577

Closed ssnepenthe closed 2 years ago

ssnepenthe commented 2 years ago

Are you using the latest stable or develop branch version of VVV?

Yes (stable)

Is it a new VVV or an existing VVV that used to work?

New fresh install

Whats the problem?

This issue goes along with https://github.com/Varying-Vagrant-Vagrants/custom-site-template/pull/56.

In a fresh provision, WP_DEBUG is defined twice.

The first comes from the default wp-cli config template: https://github.com/wp-cli/config-command/blob/ebaa455213d2e9d72880fab46a389507110fd250/templates/wp-config.mustache#L87)

The second comes the use of the extra-php option to the wp core config command: https://github.com/Varying-Vagrant-Vagrants/custom-site-template/blob/f862e5bbd1c423aa3e8dea0f6ff074394dfb6c8c/provision/vvv-init.sh#L156-L159

Later if WP_DEBUG is set via sites.{site}.custom.wpconfig_constants (https://github.com/Varying-Vagrant-Vagrants/custom-site-template/blob/f862e5bbd1c423aa3e8dea0f6ff074394dfb6c8c/provision/vvv-init.sh#L121-L135), wp-cli is only able to modify the second instance.

How do we reproduce it?

Clone VVV and run vagrant up.

Once complete, search for WP_DEBUG within www/wordpress-one/public_html/wp-config.php.

VVV Status screen

__ __ __ __
\ V\ V\ V / v3.8.1 Path:"C:/Users/Ryan/Sites/vvv"
 \_/\_/\_/  git::stable(8252690)

Platform: mingw32 windows  HasWinAdminPriv  vagrant-goodhosts monochrome-terminal shared_db_folder_disabled
Vagrant: v2.2.19, virtualbox: v6.1.32

Which Operating System are you using?

Microsoft Windows

Which provider are you using?

VirtualBox

Mte90 commented 2 years ago

So now using the native wpcli command to add the constants should avoid to duplicate it. @tomjn what do you think?

tomjn commented 2 years ago

ok so 15 days ago that template got updated to add WP_DEBUG by default, thanks for tracking down the source of the issue!

tomjn commented 2 years ago

the PR for the custom-site-template has been merged, one will be needed for custom-site-template-develop though

tomjn commented 2 years ago

looks like this has been solved, both PRs got merged, closing out

If you've encountered this you can fix it by removing the duplicate in a text editor, new sites should not have this issue