Make WordPress Core


Ignore:
Timestamp:
08/09/2016 01:44:20 AM (8 years ago)
Author:
pento
Message:

Boostrap/Load: Improve forward compatiblity of plugin global backup methods.

[37588] added methods to backup the plugin globals, for ensuring that advanced cache drop-ins don't overwrite hooks that've been added earlier in the load process.

The method for restoring the plugin globals wasn't compatible with the implementation of WP_Hook in #17817. WP_Hook implements ArrayAccess, so _restore_plugin_globals() was treating it as an array, and inadvertantly overwriting the WP_Hook object with a plain array.

To avoid having to re-write this code as part of #17817, we now use add_filter() to restore any hooks that were added by cache drop-ins, which WP_Hook correctly supports.

Props pento, jorbin.
See #36819.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-settings.php

    r38028 r38223  
    8484if ( WP_CACHE && apply_filters( 'enable_loading_advanced_cache_dropin', true ) ) {
    8585// For an advanced caching plugin to use. Uses a static drop-in because you would only want one.
    86     _backup_plugin_globals();
     86    _backup_plugin_globals( true );
    8787    WP_DEBUG ? include( WP_CONTENT_DIR . '/advanced-cache.php' ) : @include( WP_CONTENT_DIR . '/advanced-cache.php' );
    8888    _restore_plugin_globals();
Note: See TracChangeset for help on using the changeset viewer.