From 8c28881812d21eed075c70df731fb9e675bddecf Mon Sep 17 00:00:00 2001 From: Ian Dunn Date: Mon, 15 Aug 2022 10:49:53 -0700 Subject: [PATCH] Contributors: Apply `??` before array cast, to avoid PHP notice. Previously the `$user->team_names` would be cast to an array before the null coalescing operator executed. If the `team_names` field wasn't set in the database, PHP would throw an error before trying to apply the null coalescing operator. --- plugins/wporg-5ftf/includes/contributor.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/wporg-5ftf/includes/contributor.php b/plugins/wporg-5ftf/includes/contributor.php index 32cc66d..b8f5d42 100644 --- a/plugins/wporg-5ftf/includes/contributor.php +++ b/plugins/wporg-5ftf/includes/contributor.php @@ -652,7 +652,7 @@ function get_inactive_contributor_batch() : array { } $user->hours_per_week = absint( $user->hours_per_week ?? 0 ); - $user->team_names = (array) $user->team_names ?? array(); + $user->team_names = (array) ( $user->team_names ?? array() ); unset( $user->field_ids, $user->field_values ); // Remove the concatenated data now that it's exploded. }