-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Harden email-address class against multiple mailto-uri's (seen in the…
… wild in eduGAIN)
- Loading branch information
Showing
2 changed files
with
16 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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), | ||
); | ||
} | ||
|
||
|
@@ -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()); | ||
} | ||
} |