CRITICAL Uncaught Error: Cannot use object of type WP_Error as array
-
Hi, today I’m checking the WooCommerce fatal errors log and found this error several times:
CRITICAL Uncaught Error: Cannot use object of type WP_Error as array in wp-content/plugins/postmark-approved-wordpress-plugin/wp-mail.php:241
I can see you have had some incidents today (https://status.postmarkapp.com/incidents) and they seem to be related to this error.
After checking the code involved in the error, I see you are not validating the API response after this line (218):
$response = wp_remote_post( 'https://api.postmarkapp.com/email', $args );
So in the line 241 it’s throwing the critical error mentioned above as
$response
is not an array but a WP_Error:'response' => sanitize_text_field( $response['body'] )
It caused some additional issues in our WooCommerce site, as it affected the checkout ajax response and some customers didn’t get to the Thank You page.
Could you help us by adding this validation? Do you think you can release a new version with this fix as soon as possible?
Thank you.
- The topic ‘CRITICAL Uncaught Error: Cannot use object of type WP_Error as array’ is closed to new replies.