Skip to content

Commit

Permalink
Harden email-address class against multiple mailto-uri's (seen in the…
Browse files Browse the repository at this point in the history
… wild in eduGAIN)
  • Loading branch information
tvdijen committed Apr 8, 2024
1 parent 2f15711 commit a074f71
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions tests/SAML2/XML/md/EmailAddressTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ public static function setUpBeforeClass(): void
*/
public function testMarshalling(): void
{
$name = new EmailAddress('[email protected]');
$email = new EmailAddress('[email protected]');

$this->assertEquals(
self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
strval($name),
strval($email),
);
}

Expand Down Expand Up @@ -89,4 +89,17 @@ public function testUnmarshallingWithInvalidEmail(): void

EmailAddress::fromXML($document->documentElement);
}


/**
* Test that creating an EmailAddress from XML succeeds when multiple mailto: prefixes are in place.
*/
public function testUnmarshallingWithMultipleMailtoUri(): void
{
$document = clone self::$xmlRepresentation;
$document->documentElement->textContent = 'mailto:mailto:mailto:[email protected]';

$email = EmailAddress::fromXML($document->documentElement);
$this->assertEquals('mailto:[email protected]', $email->getContent());
}
}

0 comments on commit a074f71

Please sign in to comment.