Skip to content

Commit

Permalink
Prefix cannot be empty for namespaced attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
tvdijen committed Jun 4, 2023
1 parent d9597fa commit 3b7f5f5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/Attribute.php
Expand Up @@ -34,6 +34,9 @@ public function __construct(
Assert::nullOrStringNotEmpty($namespaceURI);
Assert::string($namespacePrefix);
Assert::notSame('xmlns', $namespacePrefix);
if ($namespaceURI !== null) {
Assert::stringNotEmpty($namespacePrefix);
}
Assert::stringNotEmpty($attrName);
Assert::string($attrValue);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/XML/ExtendableAttributesTraitTest.php
Expand Up @@ -42,7 +42,7 @@ public static function setUpBeforeClass(): void
{
self::$local = new Attribute(null, '', 'some', 'localValue');

self::$target = new Attribute('urn:x-simplesamlphp:namespace', '', 'some', 'targetValue');
self::$target = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'some', 'targetValue');

self::$other = new Attribute('urn:custom:dummy', 'dummy', 'some', 'dummyValue');
}
Expand Down

0 comments on commit 3b7f5f5

Please sign in to comment.