- Merge request !6Issue #3313861: Added null protector to getPreferredCore() → (Closed) created by balintpekker
When there are no available cores in the subscription, or the core id is not in the list of possible search core ids, a warning is thrown for passing null value to the foreach at line 152 of PreferredCodeService ([warning] foreach() argument must be of type array|object, null given inPreferredCoreService.php:152
). This is not a problem for the possible cores, as the event receives an empty array for the constructor, however the getAvailableCores()
method can return NULL
when there is no subscription data provided (possibly when it can't connect to Acquia Cloud?)
Update line 149 of PreferredCoreService to $available_cores = $this->getAvailableCores() ?? [];
to handle cases when there is a NULL
returned from getAvailableCores()
. (We could change the return value to an empty array, but it could be confusing as we wouldn't know if the client could connect to Acquia Cloud, or there are just no available cores.)
-
-
-
Fixed
3.1
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.