Fatal Error – add handling on json decode
-
Within function ccfw_getZoneID there is no error handling for:
$arr_result = json_decode($result['body'], true);Which can result in a fatal error:
An error of type E_ERROR was caused in line 84 of the file /wp-content/plugins/cf-cachepurger/cachepurger-for-wordpress.php. Error message: Uncaught Error: Cannot use object of type WP_Error as array in /wp-content/plugins/cf-cachepurger/cachepurger-for-wordpress.php:84Simple fix such as:
if (!is_wp_error($result)) { $arr_result = json_decode($result['body'], true); }
The topic ‘Fatal Error – add handling on json decode’ is closed to new replies.