Skip to content
Snippets Groups Projects
Commit 53bbb493 authored by Jaime Perez Crespo's avatar Jaime Perez Crespo
Browse files

SimpleSAML\Utils\Attributes::getExpectedAttribute(): Check if the attribute...

SimpleSAML\Utils\Attributes::getExpectedAttribute(): Check if the attribute has any values, and raise an exception if not.
parent 5a04fc54
No related branches found
No related tags found
No related merge requests found
......@@ -43,9 +43,13 @@ class Attributes
$attribute = $attributes[$expected];
if (!is_array($attribute)) {
throw new \SimpleSAML_Error_Exception('The attributes array is not normalized, values should be arrays.');
throw new \InvalidArgumentException('The attributes array is not normalized, values should be arrays.');
}
if (count($attribute) > 1) {
if (count($attribute) === 0) {
throw new \SimpleSAML_Error_Exception("Empty attribute '".$expected."'.'");
} elseif (count($attribute) > 1) {
if ($allow_multiple === false) {
throw new \SimpleSAML_Error_Exception(
'More than one value found for the attribute, multiple values not allowed.'
......
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