Skip to content

Commit

Permalink
Merge pull request #1170 from UN-OCHA/berliner/HPC-9880
Browse files Browse the repository at this point in the history
HPC-9880: Fix fatal error when processing entity prototypes
  • Loading branch information
berliner authored Nov 11, 2024
2 parents 79b4f9d + 795d546 commit 574d91d
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,11 @@ public function getSupportedPrototypeIds() {
if (empty($this->can_support)) {
return [];
}
$can_support = array_filter($this->can_support, function ($item) {
// The value of can support is either an array or some kind of logical
// wrapper object. We need an array, so if it's an object, let's see if
// it's one we know, like xor, and then get it's sub items as an array.
$can_support = is_array($this->can_support) ? $this->can_support : (is_object($this->can_support) && property_exists($this->can_support, 'xor') ? $this->can_support->xor : []);
$can_support = array_filter($can_support, function ($item) {
// Ignore items that are not objects, it's probably an "xor" thing that
// we don't want to handle at the moment.
return is_object($item) && property_exists($item, 'id');
Expand Down

0 comments on commit 574d91d

Please sign in to comment.