roots / bedrock

WordPress boilerplate with Composer, easier configuration, and an improved folder structure
https://roots.io/bedrock/
MIT License
6.15k stars 1.16k forks source link

Avoid redefining `DISALLOW_FILE_EDIT` #726

Open joshuafredrickson opened 2 months ago

joshuafredrickson commented 2 months ago

Some security plugins will automatically edit wp-config.php and then throw an error:

Fatal error: Uncaught Roots\WPConfig\Exceptions\ConstantAlreadyDefinedException:
Aborted trying to redefine constant 'DISALLOW_FILE_EDIT'.
`define('DISALLOW_FILE_EDIT', ...)` has already been occurred elsewhere.

I know this happens with at least two plugins:

Of course, adding these constants to wp-config.php in Bedrock isn't ideal, but this check at least keeps the fatal error from triggering when working with these plugins.

I'm not sold this is something that Bedrock needs to address... It's just something I've encountered a few times in the wild. I could be convinced either way.

thedavidthomas commented 1 month ago

+1 - Solid Security Pro (previously called iThemes Security Pro) user here. I have been doing this programatically immediately after creating a bedrock project since DISALLOW_FILE_EDIT is added automatically to wp-config.php on activation.