From d3c9f7728574dab99e5e016dd11a5e31cc2262fb Mon Sep 17 00:00:00 2001 From: Olav Morken <olav.morken@uninett.no> Date: Fri, 26 Mar 2010 14:02:02 +0000 Subject: [PATCH] metaedit: Set index-property correctly. git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@2241 44740490-163a-0410-bde0-09ae8108e29a --- modules/metaedit/lib/MetaEditor.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/modules/metaedit/lib/MetaEditor.php b/modules/metaedit/lib/MetaEditor.php index f3817390d..0d8335853 100644 --- a/modules/metaedit/lib/MetaEditor.php +++ b/modules/metaedit/lib/MetaEditor.php @@ -18,10 +18,16 @@ class sspmod_metaedit_MetaEditor { } } - protected function getEndpointField($request, &$metadata, $key, $binding) { + protected function getEndpointField($request, &$metadata, $key, $binding, $indexed) { if (array_key_exists('field_' . $key, $request)) { - $e = array(array('Binding' => $binding, 'Location' => $request['field_' . $key], 'index' => '0')); - $metadata[$key] = $e; + $e = array( + 'Binding' => $binding, + 'Location' => $request['field_' . $key] + ); + if ($indexed) { + $e['index'] = 0; + } + $metadata[$key] = array($e); } else { if (isset($metadata[$key])) unset($metadata[$key]); } @@ -31,8 +37,8 @@ class sspmod_metaedit_MetaEditor { $this->getStandardField($request, $metadata, 'entityid'); $this->getStandardField($request, $metadata, 'name'); $this->getStandardField($request, $metadata, 'description'); - $this->getEndpointField($request, $metadata, 'AssertionConsumerService', SAML2_Const::BINDING_HTTP_POST); - $this->getEndpointField($request, $metadata, 'SingleLogoutService', SAML2_Const::BINDING_HTTP_REDIRECT); + $this->getEndpointField($request, $metadata, 'AssertionConsumerService', SAML2_Const::BINDING_HTTP_POST, TRUE); + $this->getEndpointField($request, $metadata, 'SingleLogoutService', SAML2_Const::BINDING_HTTP_REDIRECT, FALSE); // $this->getStandardField($request, $metadata, 'certFingerprint'); $metadata['updated'] = time(); -- GitLab