From 6e3322250a412f6b24538c59e3d8d42091e6df5c Mon Sep 17 00:00:00 2001 From: Tyler Antonio <tantonio@ualberta.ca> Date: Wed, 9 Nov 2016 14:36:21 -0700 Subject: [PATCH] Address issues from unit tests --- lib/SimpleSAML/Utils/Config/Metadata.php | 2 +- tests/lib/SimpleSAML/Utils/Config/MetadataTest.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/SimpleSAML/Utils/Config/Metadata.php b/lib/SimpleSAML/Utils/Config/Metadata.php index 8232e2d3f..297cae30a 100644 --- a/lib/SimpleSAML/Utils/Config/Metadata.php +++ b/lib/SimpleSAML/Utils/Config/Metadata.php @@ -117,7 +117,7 @@ class Metadata // check attributes is an associative array if (isset($contact['attributes'])) { - if (empty($contact['attributes']) || empty(array_filter(array_keys($contact['attributes']), 'is_string'))) { + if (empty($contact['attributes']) || !is_array($contact['attributes']) || empty(array_filter(array_keys($contact['attributes']), 'is_string'))) { throw new \InvalidArgumentException('"attributes" must be an array and cannot be empty.'); } } diff --git a/tests/lib/SimpleSAML/Utils/Config/MetadataTest.php b/tests/lib/SimpleSAML/Utils/Config/MetadataTest.php index 318983438..95f0aa547 100644 --- a/tests/lib/SimpleSAML/Utils/Config/MetadataTest.php +++ b/tests/lib/SimpleSAML/Utils/Config/MetadataTest.php @@ -215,6 +215,7 @@ class MetadataTest extends \PHPUnit_Framework_TestCase } $contact['contactType'] = 'technical'; $contact['name'] = 'to_be_removed'; + $contact['attributes'] = array('test' => 'testval'); $parsed = Metadata::getContact($contact); foreach (array_keys($parsed) as $key) { $this->assertEquals($parsed[$key], $contact[$key]); -- GitLab