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.
This commit is contained in:
Ian Dunn 2022-08-15 10:49:53 -07:00
parent 993bd53765
commit 8c28881812
No known key found for this signature in database
GPG key ID: 99B971B50343CBCB

View file

@ -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.
}