Closed ryanvalentin closed 6 years ago
Using the WordPress functions wp_remote_get and wp_remote_post can return either an array (success) or an instance of WP_Error if there was an exception. Currently we're treating either case as an array: https://github.com/disqus/disqus-wordpress-plugin/blob/7d5531e4f3e1746b2291f8e2664430433e8dbf17/disqus/includes/class-disqus-api-service.php#L82
wp_remote_get
wp_remote_post
WP_Error
When the Disqus API throws an error, a new exception gets created trying to access the WP_Error object as an array.
We need to detect when an error is thrown and return the appropriate response from there.
Using the WordPress functions
wp_remote_get
andwp_remote_post
can return either an array (success) or an instance ofWP_Error
if there was an exception. Currently we're treating either case as an array: https://github.com/disqus/disqus-wordpress-plugin/blob/7d5531e4f3e1746b2291f8e2664430433e8dbf17/disqus/includes/class-disqus-api-service.php#L82When the Disqus API throws an error, a new exception gets created trying to access the
WP_Error
object as an array.We need to detect when an error is thrown and return the appropriate response from there.