Skip to content
Snippets Groups Projects
Commit c2de3dc1 authored by Mischa Salle's avatar Mischa Salle
Browse files

Check explicitly whether array element is defined

Check whether http://macedir.org/entity-category is set in the EntityAttributes
before using it as argument in in_array(). This prevents a "TypeError:
in_array() expects parameter 2 to be array, null given" error.

This situation happens when we do have EntityAttributes in the metadata but
none of type "http://macedir.org/entity-category". An example is an IdP
supporting https://refeds.org/category/research-and-scholarship, which would
have "http://macedir.org/entity-category-support" but not per se also
"http://macedir.org/entity-category".
parent 3d0de8e2
No related branches found
No related tags found
No related merge requests found
...@@ -298,10 +298,10 @@ class Metadata ...@@ -298,10 +298,10 @@ class Metadata
*/ */
public static function isHiddenFromDiscovery(array $metadata): bool public static function isHiddenFromDiscovery(array $metadata): bool
{ {
Logger::maskErrors(E_ALL); if (!isset($metadata['EntityAttributes'][self::$ENTITY_CATEGORY])) {
$hidden = in_array(self::$HIDE_FROM_DISCOVERY, $metadata['EntityAttributes'][self::$ENTITY_CATEGORY], true); return false;
Logger::popErrorMask(); }
return $hidden === true; return in_array(self::$HIDE_FROM_DISCOVERY, $metadata['EntityAttributes'][self::$ENTITY_CATEGORY], true);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment