Automattic / vip-decoupled-bundle

WordPress VIP decoupled plugin bundle
29 stars 5 forks source link

GraphQL registration can cause warnings #64

Closed joemcgill closed 2 years ago

joemcgill commented 2 years ago

The WPCOMVIP\Decoupled\Registration\register_custom_post_types() function checks for two array keys, _builtin and public, which may not exist when this function is called. This function is a callback for the register_post_type_args hook, which is called before the WP_Post_Type class adds default args to the post type args passed to the constructor. If those array keys do not exists when GraphQL registration checks their value, a PHP warning will occur.

See: https://github.com/Automattic/vip-decoupled-bundle/blob/trunk/registration/registration.php#L19-L20.

A possible fix is to do an isset() check on those keys before checking their values.

chriszarate commented 2 years ago

Thanks, @joemcgill. Addressed in https://github.com/Automattic/vip-decoupled-bundle/pull/65, will get it merged soon.