From bbf5e1d12651a750b3be6d8b371a5dcbf49d4dcd Mon Sep 17 00:00:00 2001
From: Thijs Kinkhorst <thijs@kinkhorst.com>
Date: Wed, 6 Aug 2014 14:19:41 +0000
Subject: [PATCH] Check that IdP names contain content before attempting
 translation.

getTranslation() will throw an unhandled exception when passed an
empty array, and there's no use in checking for translations of
empty stuff anyway.
---
 templates/selectidp-dropdown.php | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/templates/selectidp-dropdown.php b/templates/selectidp-dropdown.php
index 2ac0ef87b..27fbc36e7 100644
--- a/templates/selectidp-dropdown.php
+++ b/templates/selectidp-dropdown.php
@@ -10,18 +10,18 @@ $this->data['autofocus'] = 'dropdownlist';
 $this->includeAtTemplateBase('includes/header.php');
 
 foreach ($this->data['idplist'] AS $idpentry) {
-	if (isset($idpentry['UIInfo']['DisplayName'])) {
+	if (!empty($idpentry['UIInfo']['DisplayName'])) {
 		/* TODO: remove this branch, If ['UIInfo']['DisplayName'] is available, it will get through to 'name' in the
 		 * metadata parsed with SSP >= 1.13.0, so this code is no longer necessary. Keep it now to avoid breaking
 		 * metadata parsed with previous versions.
 		 */
 		$this->includeInlineTranslation('idpname_' . $idpentry['entityid'], $idpentry['UIInfo']['DisplayName']);
-	} elseif (isset($idpentry['name'])) {
+	} elseif (!empty($idpentry['name'])) {
 		$this->includeInlineTranslation('idpname_' . $idpentry['entityid'], $idpentry['name']);
-	} elseif (isset($idpentry['OrganizationDisplayName'])) {
+	} elseif (!empty($idpentry['OrganizationDisplayName'])) {
 		$this->includeInlineTranslation('idpname_' . $idpentry['entityid'], $idpentry['OrganizationDisplayName']);
 	}
-	if (isset($idpentry['description']))
+	if (!empty($idpentry['description']))
 		$this->includeInlineTranslation('idpdesc_' . $idpentry['entityid'], $idpentry['description']);
 }
 
-- 
GitLab