WP 4.7, object-cache.php breaks the site if APC is not enabled in php
|Reported by:||innocuo||Owned by:||dd32|
This happens if PHP doesn't have APC enabled.
In wp-includes/object-cache.php: the code checks if APC is enabled, by checking the existence of the function 'apc_fetch'. If it isn't, then it sets $GLOBALS['_wp_using_ext_object_cache'] to false, and manually adds a filter to $wp_filter['all'] , like this:
$GLOBALS['wp_filter']['all'][-100]['apc_not_actually_running'] = array( 'function' => 'apc_not_actually_running', 'accepted_args' => 0 );
Then, when _wp_call_all_hook() is called (this is in wp-includes/plugin.php), the code breaks.
This happens because it does this:
$wp_filter['all']->do_all_hook( $args );
meaning, it expects $wp_filter['all'] to be a WP_Hook object, but it is an array due to the override that happened in object-cache.php (mentioned above).
An "solution" for users would be to install and enable APC on php,
or comment the line that adds the filter as an array in object-cache.php (line 667 in the latest version). The real solution would be to add this filter using/via WP_Hook?
Change History (23)
- Summary changed from WP 4.7 breaks if APC is not enabled in php to WP 4.7, object-cache.php breaks the site if APC is not enabled in php
- Keywords fixed-major added
- Resolution fixed deleted
- Status changed from closed to reopened