Title: Plugin causes fatal error when clearing cache
Last modified: January 6, 2021

---

# Plugin causes fatal error when clearing cache

 *  Resolved [ovidijusk](https://wordpress.org/support/users/ovidijusk/)
 * (@ovidijusk)
 * [5 years, 5 months ago](https://wordpress.org/support/topic/plugin-causes-fatal-error-when-clearing-cache/)
 * Plugin version: 5.7.12
 * Error message: PHP Fatal error: Uncaught Error: Cannot use object of type WP_Error
   as array in public_html/wp-content/plugins/sg-cachepress/core/DNS/Cloudflare.
   php on line 155
 * This errors occurs sometimes when crearing cache.
    This plugin uses WordPress
   HTTP API (like wp_remote_get() functions) to make HTTP requests. When request
   fails, plugin doesn’t handle WP_Error. Here’s the code that causes error:
 * if ( empty( $response[‘result’][0][‘id’] ) ) {
 * It should be like this:
    if ( is_wp_error($response) || empty( $response[‘result’][
   0][‘id’] ) ) {
 * According to documentation [https://developer.wordpress.org/reference/functions/wp_remote_get/](https://developer.wordpress.org/reference/functions/wp_remote_get/),
   WP_Error is returned when function fails.

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [Stoyan Georgiev](https://wordpress.org/support/users/stoyangeorgiev/)
 * (@stoyangeorgiev)
 * [5 years, 5 months ago](https://wordpress.org/support/topic/plugin-causes-fatal-error-when-clearing-cache/#post-13875612)
 * Hey there [@ovidijusk](https://wordpress.org/support/users/ovidijusk/),
 * Is it possible to provide a site URL, so we can check the issue? Also, the exact
   steps to recreate the issue will be highly appreciated (like go on that specific
   page, do that action, click that button).
 * Kind regards,
    Stoyan
 *  Plugin Author [Stoyan Georgiev](https://wordpress.org/support/users/stoyangeorgiev/)
 * (@stoyangeorgiev)
 * [5 years, 5 months ago](https://wordpress.org/support/topic/plugin-causes-fatal-error-when-clearing-cache/#post-13897064)
 * Marking as resolved due to no reply.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Plugin causes fatal error when clearing cache’ is closed to new replies.

 * ![](https://ps.w.org/sg-cachepress/assets/icon-256x256.gif?rev=2971889)
 * [Speed Optimizer - The All-In-One Performance-Boosting Plugin](https://wordpress.org/plugins/sg-cachepress/)
 * [Support Threads](https://wordpress.org/support/plugin/sg-cachepress/)
 * [Active Topics](https://wordpress.org/support/plugin/sg-cachepress/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/sg-cachepress/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/sg-cachepress/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Stoyan Georgiev](https://wordpress.org/support/users/stoyangeorgiev/)
 * Last activity: [5 years, 5 months ago](https://wordpress.org/support/topic/plugin-causes-fatal-error-when-clearing-cache/#post-13897064)
 * Status: resolved