Make WordPress Core

Opened 15 years ago

Closed 15 years ago

#10602 closed defect (bug) (fixed)

if WP_CACHE is defined as false advanced-cache file will still be loaded

Reported by: dandean's profile dandean Owned by: ryan's profile ryan
Milestone: 2.9 Priority: normal
Severity: normal Version: 2.9
Component: Cache API Keywords: has-patch tested
Focuses: Cc:

Description

Line 214 of wp-settings.php is prone to confusing people if WP_CACHE is set to FALSE (or any othe value that is not TRUE). The IF statement is only checking that WP_CACHE is set, not that it is set to TRUE:

if ( defined('WP_CACHE') )
	@include WP_CONTENT_DIR . '/advanced-cache.php';

Something like this would be much better:

if ( defined('WP_CACHE') && WP_CACHE == true )
	@include WP_CONTENT_DIR . '/advanced-cache.php';

This would be even better (pseudo-code... removing "@" from include statement), but I understand if it violates other more important concerns:

if ( defined('WP_CACHE') && WP_CACHE == true ) {
    try {
        include WP_CONTENT_DIR . '/advanced-cache.php';
    } catch (Exception $e) {
        die("Advanced cache not configured. " + $e->getMessage());
    }
}

Attachments (1)

10602.patch (401 bytes) - added by nacin 15 years ago.
In patch form

Download all attachments as: .zip

Change History (6)

#1 @Denis-de-Bernardy
15 years ago

try catch is php 5

#2 @scribu
15 years ago

  • Milestone changed from Unassigned to 2.9

@nacin
15 years ago

In patch form

#3 @nacin
15 years ago

  • Keywords has-patch tested added
  • Version changed from 2.8.3 to 2.9

#4 @scribu
15 years ago

  • Keywords changed from has-patch, tested to has-patch tested

#5 @automattor
15 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [12192]) Make sure WP_CACHE is true. Props nacin. fixes #10602

Note: See TracTickets for help on using tickets.