AttributeAlter: remove attributes when all their values are removed by the filter.

git-svn-id: http://simplesamlphp.googlecode.com/svn/trunk@3366 44740490-163a-0410-bde0-09ae8108e29a
This commit is contained in:
jaimepc@gmail.com 2014-02-17 17:06:43 +00:00
parent 724f878933
commit bd4897d0eb
1 changed files with 4 additions and 0 deletions

View File

@ -166,6 +166,10 @@ class sspmod_core_Auth_Process_AttributeAlter extends SimpleSAML_Auth_Processing
}
}
$attributes[$this->target] = array_diff($attributes[$this->subject], $removedAttrs);
if (empty($attributes[$this->target])) {
unset($attributes[$this->target]);
}
} else { // replace only the part that matches
if ($this->subject === $this->target) {
$attributes[$this->target] = preg_replace($this->pattern, $this->replacement,