Automattic / Automattic/wp-super-cache

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

Open
#989 3 comments 0 reactions 1 assignee Claimed by @donnchawp View on GitHub
[Plugin] Super Cache bug
Dominant language
PHP
Stars
436
Forks
130
Avg merge
15h 11m
Merged PRs (30d)
10

Description

### 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](https://wordpress.org/support/topic/wp-config-php-and-ithemes-security/) 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_

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.