Skip to content

Commit 54e4791

Browse files
committed
bugfix: Make sure we can deal with attribute values that are not strings (i.e. DOMNodeList).
This is due to the update of the SAML2 library, that caused several other bugs, mainly with attributes like eduPersonTargetedID, which should always be an SAML NameID.
1 parent 2ad4852 commit 54e4791

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

www/authmemcookie.php

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,21 @@
7474

7575
// store the authentication data in the memcache server
7676
$data = '';
77-
foreach ($authData as $n => $v) {
78-
if (is_array($v)) {
79-
$v = implode(':', $v);
77+
foreach ($authData as $name => $values) {
78+
if (is_array($values)) {
79+
foreach ($values as $i => $value) {
80+
if (!is_a($value, 'DOMNodeList')) {
81+
continue;
82+
}
83+
/* @var \DOMNodeList $value */
84+
if ($value->length === 0) {
85+
continue;
86+
}
87+
$values[$i] = new \SAML2\XML\saml\AttributeValue($value->item(0)->parentNode);
88+
}
89+
$values = implode(':', $values);
8090
}
81-
$data .= $n.'='.$v."\r\n";
91+
$data .= $name.'='.$values."\r\n";
8292
}
8393

8494
$memcache = $amc->getMemcache();

0 commit comments

Comments
 (0)