WP_Error object saved to user meta
-
Hi, Just had to debug a very strange bug that we cannot reproduce but somehow a user had an error when uploading their avatar file and a WP_Error object was the result. WP User Avatars proceeded to save said object into the database! Then each time that avatar was supposed to be retrieved there was an error:
“Uncaught Error: Cannot use object of type WP_Error as array in … plugins/wp-user-avatar-pro/classes/class-wp-user-avatar-functions.php:836”It took a while to trace the issue and then saw this from the wp cli:
| ##### | REDACTED_user_avatar | a:1:{i:0;O:8:"WP_Error":2:{s:6:" | | | | errors";a:1:{s:19:"file_upload_p | | | | roblem";a:1:{i:0;s:89:"Media ava | | | | tar could't uploading please che | | | | ck you have right permission for | | | | uploads folder.";}}s:10:"error_ | | | | data";a:0:{}}} | +---------+---------------------------------+----------------------------------+There seems to not be a check before the data is saved into the user meta that the correct / expected structure is in place.
our remedy was to just remove that user’s user meta, but wanted to report the issue so a check can be added so this doesn’t happen again.
The topic ‘WP_Error object saved to user meta’ is closed to new replies.