humanmade / authorship

A modern approach to author attribution in WordPress.
GNU General Public License v3.0
66 stars 7 forks source link

Fix REST response callback #125

Closed nlemoine closed 1 year ago

nlemoine commented 1 year ago

Check that $data is an array before checking if REST_PARAM is set. Avoid triggering Cannot use object of type stdClass as array when response data is an object.

nlemoine commented 1 year ago

Or is this for a custom REST API endpoint that is setting data differently?

Yes, I stumbled upon this issue with Yoast SEO: https://github.com/Yoast/wordpress-seo/blob/b65a01a4e121eac60b4614ef637bcdaa20545e36/src/routes/alert-dismissal-route.php#L89 (not that exact example, this is only intended to confirm that sometimes, objects can be returned).

nlemoine commented 1 year ago

Hello @mattheu,

Any news about this? :)

mattheu commented 1 year ago

I apologise! Totally slipped my mind.

nlemoine commented 1 year ago

Thanks! :)