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

WP Super Cache: iThemes Security overwrites the WP_CACHE define in wp-config.php #32462

Open
donnchawp opened this issue Aug 14, 2023 · 3 comments
Assignees
Labels
[Plugin] Super Cache A fast caching plugin for WordPress. [Pri] Low [Type] Bug When a feature is broken and / or not performing as intended User Report

Comments

@donnchawp
Copy link
Contributor

Impacted plugin

Super Cache

Quick summary

The iThemes Security plugin sometimes writes to the file wp-config.php and deletes the WP_CACHE define added by WP Super Cache.

The code that WP Super Cache uses to update the config files searches for a string to add a new settings above it. In the case of the wp-config.php, it matches on "define", but it appears likely that iThemes Security adds a define(), which gets matched. That causes the configuration of both plugins to be mixed up.

We will have to update the code that modifies wp-config.php to avoid this problem, probably by checking for the opening PHP tag instead.

It looks like it only happens if WP Super Cache is enabled after the other plugin.

Steps to reproduce

I gather from the forum post that iThemes Security occasionally updates their configuration data, and WP Super Cache will add the WP_CACHE define in there if it is enabled afterwards.

A clear and concise description of what you expected to happen.

The configuration data for both plugins to be separated

What actually happened

The WP_CACHE define for WP Super Cache is inserted into the iThemes Security plugin configuration data in wp-config.php and is deleted if that plugin updates the configuration data.

Impact

Some (< 50%)

Available workarounds?

Yes, easy to implement

Platform (Simple and/or Atomic)

Self-hosted

Logs or notes

No response

@donnchawp donnchawp added [Type] Bug When a feature is broken and / or not performing as intended User Report Needs triage Ticket needs to be triaged labels Aug 14, 2023
@donnchawp donnchawp self-assigned this Aug 14, 2023
@github-actions github-actions bot added [Plugin] Super Cache A fast caching plugin for WordPress. [Pri] Low labels Aug 14, 2023
@jeherve jeherve removed the Needs triage Ticket needs to be triaged label Aug 14, 2023
@donnchawp
Copy link
Contributor Author

A simple way to fix this is by modifying the "replace_line" function in the plugin so it looks for the first opening PHP tag, rather than the "if ( define" string it currently uses. It can add the new line after that tag.
Another way would be to add the new line right at the top of the file, enclosed by open and closing PHP tags.

@JayHoltslander
Copy link

It looks like it only happens if WP Super Cache is enabled after the other plugin.

Good to know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Plugin] Super Cache A fast caching plugin for WordPress. [Pri] Low [Type] Bug When a feature is broken and / or not performing as intended User Report
3 participants