From d6ee7980efed94bd718fc18a9017f3b16e5b5f00 Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Fri, 5 Jun 2026 21:05:20 +0200 Subject: [PATCH 1/3] Bump minimum PHP-version to 8.5 --- .github/workflows/php.yml | 8 ++++---- composer.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index a89cd72..bfe41a5 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -19,7 +19,7 @@ jobs: strategy: fail-fast: false matrix: - php-version: ['8.3', '8.4', '8.5'] + php-version: ['8.5'] uses: simplesamlphp/simplesamlphp-test-framework/.github/workflows/reusable_phplinter.yml@v1 secrets: inherit @@ -47,7 +47,7 @@ jobs: fail-fast: false matrix: operating-system: [ubuntu-latest] - php-versions: ['8.3', '8.4', '8.5'] + php-versions: ['8.5'] steps: - name: Setup PHP, with composer and extensions @@ -109,7 +109,7 @@ jobs: fail-fast: true matrix: operating-system: [windows-latest] - php-versions: ['8.3', '8.4', '8.5'] + php-versions: ['8.5'] steps: - name: Setup PHP, with composer and extensions @@ -217,7 +217,7 @@ jobs: uses: shivammathur/setup-php@v2 with: # Should be the lowest supported version - php-version: '8.3' + php-version: '8.5' extensions: ctype, date, dom, filter, pcre, soap, spl, xml tools: composer coverage: none diff --git a/composer.json b/composer.json index b2edc27..bb396b1 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,7 @@ } ], "require": { - "php": "^8.3", + "php": "^8.5", "ext-dom": "*", "ext-spl": "*", From e0435c6c0c89bffcbbfd90da214a5848af7ca1d4 Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Fri, 5 Jun 2026 21:19:40 +0200 Subject: [PATCH 2/3] Migrate DOM-classes to PHP 8.4's new DOM-API --- composer.json | 4 ++-- src/Utils/XPath.php | 11 +++++------ src/XML/wsp_200409/AbstractOperatorContentType.php | 10 +++++----- src/XML/wsp_200409/AppliesTo.php | 10 +++++----- src/XML/wsp_200409/Policy.php | 10 +++++----- src/XML/wsp_200409/PolicyAttachment.php | 10 +++++----- src/XML/wsp_200409/PolicyReference.php | 10 +++++----- src/XML/wsp_200607/AbstractOperatorContentType.php | 10 +++++----- src/XML/wsp_200607/AbstractURI.php | 10 +++++----- src/XML/wsp_200607/AppliesTo.php | 10 +++++----- src/XML/wsp_200607/Policy.php | 10 +++++----- src/XML/wsp_200607/PolicyAttachment.php | 10 +++++----- src/XML/wsp_200607/PolicyReference.php | 10 +++++----- tests/Policy/XML/wsp_200409/AllTest.php | 9 +++++---- tests/Policy/XML/wsp_200409/AppliesToTest.php | 13 +++++++------ tests/Policy/XML/wsp_200409/ExactlyOneTest.php | 9 +++++---- .../Policy/XML/wsp_200409/PolicyAttachmentTest.php | 9 +++++---- tests/Policy/XML/wsp_200409/PolicyReferenceTest.php | 11 ++++++----- tests/Policy/XML/wsp_200409/PolicyTest.php | 9 +++++---- tests/Policy/XML/wsp_200607/AllTest.php | 9 +++++---- tests/Policy/XML/wsp_200607/AppliesToTest.php | 13 +++++++------ tests/Policy/XML/wsp_200607/ExactlyOneTest.php | 9 +++++---- .../Policy/XML/wsp_200607/PolicyAttachmentTest.php | 9 +++++---- tests/Policy/XML/wsp_200607/PolicyReferenceTest.php | 11 ++++++----- tests/Policy/XML/wsp_200607/PolicyTest.php | 9 +++++---- tests/Policy/XML/wsp_200607/URITest.php | 9 +++++---- 26 files changed, 133 insertions(+), 121 deletions(-) diff --git a/composer.json b/composer.json index bb396b1..d3b19e4 100644 --- a/composer.json +++ b/composer.json @@ -15,8 +15,8 @@ "ext-spl": "*", "simplesamlphp/assert": "~2.0", - "simplesamlphp/xml-common": "~2.8", - "simplesamlphp/xml-wss-core": "~1.4" + "simplesamlphp/xml-common": "dev-feature/dom-migration-php84", + "simplesamlphp/xml-wss-core": "dev-feature/dom-migration-php84" }, "require-dev": { "simplesamlphp/simplesamlphp-test-framework": "~1.11", diff --git a/src/Utils/XPath.php b/src/Utils/XPath.php index 87bb25b..1d03ccf 100644 --- a/src/Utils/XPath.php +++ b/src/Utils/XPath.php @@ -4,8 +4,7 @@ namespace SimpleSAML\WebServices\Policy\Utils; -use DOMNode; -use DOMXPath; +use Dom; use SimpleSAML\WebServices\Policy\Constants as C; /** @@ -16,15 +15,15 @@ class XPath extends \SimpleSAML\XPath\XPath { /* - * Get a DOMXPath object that can be used to search for WS Security elements. + * Get a Dom\XPath object that can be used to search for WS Security elements. * - * @param \DOMNode $node The document to associate to the DOMXPath object. + * @param \Dom\Node $node The document to associate to the Dom\XPath object. * @param bool $autoregister Whether to auto-register all namespaces used in the document * - * @return \DOMXPath A DOMXPath object ready to use in the given document, with several + * @return \Dom\XPath A Dom\XPath object ready to use in the given document, with several * ws-related namespaces already registered. */ - public static function getXPath(DOMNode $node, bool $autoregister = false): DOMXPath + public static function getXPath(Dom\Node $node, bool $autoregister = false): Dom\XPath { $xp = parent::getXPath($node, $autoregister); diff --git a/src/XML/wsp_200409/AbstractOperatorContentType.php b/src/XML/wsp_200409/AbstractOperatorContentType.php index 4961e2c..53dcc83 100644 --- a/src/XML/wsp_200409/AbstractOperatorContentType.php +++ b/src/XML/wsp_200409/AbstractOperatorContentType.php @@ -4,7 +4,7 @@ namespace SimpleSAML\WebServices\Policy\XML\wsp_200409; -use DOMElement; +use Dom; use InvalidArgumentException; use SimpleSAML\WebServices\Policy\Assert\Assert; use SimpleSAML\XML\Constants as C; @@ -93,12 +93,12 @@ public function isEmptyElement(): bool /* * Convert XML into an wsp:OperatorContentType element * - * @param \DOMElement $xml The XML element we should load + * @param \Dom\Element $xml The XML element we should load * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * If the qualified name of the supplied element is wrong */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class); Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); @@ -118,9 +118,9 @@ public static function fromXML(DOMElement $xml): static /** * Convert this wsp:OperatorContentType to XML. * - * @param \DOMElement|null $parent The element we should add this wsp:OperatorContentType to. + * @param \Dom\Element|null $parent The element we should add this wsp:OperatorContentType to. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = $this->instantiateParentElement($parent); diff --git a/src/XML/wsp_200409/AppliesTo.php b/src/XML/wsp_200409/AppliesTo.php index 5fd405a..2baa237 100644 --- a/src/XML/wsp_200409/AppliesTo.php +++ b/src/XML/wsp_200409/AppliesTo.php @@ -4,7 +4,7 @@ namespace SimpleSAML\WebServices\Policy\XML\wsp_200409; -use DOMElement; +use Dom; use SimpleSAML\WebServices\Policy\Assert\Assert; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; @@ -57,12 +57,12 @@ public function isEmptyElement(): bool /* * Convert XML into an wsp:AppliesTo element * - * @param \DOMElement $xml The XML element we should load + * @param \Dom\Element $xml The XML element we should load * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * If the qualified name of the supplied element is wrong */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, 'AppliesTo', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, AppliesTo::NS, InvalidDOMElementException::class); @@ -77,9 +77,9 @@ public static function fromXML(DOMElement $xml): static /** * Convert this wsp:AppliesTo to XML. * - * @param \DOMElement|null $parent The element we should add this wsp:AppliesTo to. + * @param \Dom\Element|null $parent The element we should add this wsp:AppliesTo to. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = $this->instantiateParentElement($parent); diff --git a/src/XML/wsp_200409/Policy.php b/src/XML/wsp_200409/Policy.php index 11f880f..64d62c9 100644 --- a/src/XML/wsp_200409/Policy.php +++ b/src/XML/wsp_200409/Policy.php @@ -4,7 +4,7 @@ namespace SimpleSAML\WebServices\Policy\XML\wsp_200409; -use DOMElement; +use Dom; use SimpleSAML\WebServices\Policy\Assert\Assert; use SimpleSAML\WebServices\Policy\Constants as C; use SimpleSAML\WebServices\Security\Type\IDValue; @@ -99,13 +99,13 @@ final public function isEmptyElement(): bool /* * Convert XML into an wsp:Policy element * - * @param \DOMElement $xml The XML element we should load + * @param \Dom\Element $xml The XML element we should load * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * If the qualified name of the supplied element is wrong */ #[\Override] - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class); Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); @@ -133,9 +133,9 @@ public static function fromXML(DOMElement $xml): static /** * Convert this wsp:Policy to XML. * - * @param \DOMElement|null $parent The element we should add this wsp:Policy to + * @param \Dom\Element|null $parent The element we should add this wsp:Policy to */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = parent::toXML($parent); diff --git a/src/XML/wsp_200409/PolicyAttachment.php b/src/XML/wsp_200409/PolicyAttachment.php index 6c4a33d..972fefb 100644 --- a/src/XML/wsp_200409/PolicyAttachment.php +++ b/src/XML/wsp_200409/PolicyAttachment.php @@ -4,7 +4,7 @@ namespace SimpleSAML\WebServices\Policy\XML\wsp_200409; -use DOMElement; +use Dom; use SimpleSAML\WebServices\Policy\Assert\Assert; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; @@ -93,12 +93,12 @@ public function getPolicies(): array /* * Convert XML into an wsp:PolicyAttachment element * - * @param \DOMElement $xml The XML element we should load + * @param \Dom\Element $xml The XML element we should load * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * If the qualified name of the supplied element is wrong */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class); Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); @@ -125,9 +125,9 @@ public static function fromXML(DOMElement $xml): static /** * Convert this wsp:PolicyAttachment to XML. * - * @param \DOMElement|null $parent The element we should add this wsp:AppliesTo to. + * @param \Dom\Element|null $parent The element we should add this wsp:AppliesTo to. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = $this->instantiateParentElement($parent); diff --git a/src/XML/wsp_200409/PolicyReference.php b/src/XML/wsp_200409/PolicyReference.php index 591badc..77772df 100644 --- a/src/XML/wsp_200409/PolicyReference.php +++ b/src/XML/wsp_200409/PolicyReference.php @@ -4,7 +4,7 @@ namespace SimpleSAML\WebServices\Policy\XML\wsp_200409; -use DOMElement; +use Dom; use SimpleSAML\WebServices\Policy\Assert\Assert; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\SchemaValidatableElementInterface; @@ -84,12 +84,12 @@ public function getDigestAlgorithm(): ?AnyURIValue /* * Convert XML into an wsp:PolicyReference element * - * @param \DOMElement $xml The XML element we should load + * @param \Dom\Element $xml The XML element we should load * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * If the qualified name of the supplied element is wrong */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class); Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); @@ -106,9 +106,9 @@ public static function fromXML(DOMElement $xml): static /** * Convert this wsp:PolicyReference to XML. * - * @param \DOMElement|null $parent The element we should add this wsp:Policy to + * @param \Dom\Element|null $parent The element we should add this wsp:Policy to */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = $this->instantiateParentElement($parent); $e->setAttribute('URI', $this->getURI()->getValue()); diff --git a/src/XML/wsp_200607/AbstractOperatorContentType.php b/src/XML/wsp_200607/AbstractOperatorContentType.php index e6fdfdd..db95da3 100644 --- a/src/XML/wsp_200607/AbstractOperatorContentType.php +++ b/src/XML/wsp_200607/AbstractOperatorContentType.php @@ -4,7 +4,7 @@ namespace SimpleSAML\WebServices\Policy\XML\wsp_200607; -use DOMElement; +use Dom; use InvalidArgumentException; use SimpleSAML\WebServices\Policy\Assert\Assert; use SimpleSAML\XML\Constants as C; @@ -95,12 +95,12 @@ public function isEmptyElement(): bool /* * Convert XML into an wsp:OperatorContentType element * - * @param \DOMElement $xml The XML element we should load + * @param \Dom\Element $xml The XML element we should load * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * If the qualified name of the supplied element is wrong */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class); Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); @@ -120,9 +120,9 @@ public static function fromXML(DOMElement $xml): static /** * Convert this wsp:OperatorContentType to XML. * - * @param \DOMElement|null $parent The element we should add this wsp:OperatorContentType to. + * @param \Dom\Element|null $parent The element we should add this wsp:OperatorContentType to. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = $this->instantiateParentElement($parent); diff --git a/src/XML/wsp_200607/AbstractURI.php b/src/XML/wsp_200607/AbstractURI.php index d091c8d..194b12a 100644 --- a/src/XML/wsp_200607/AbstractURI.php +++ b/src/XML/wsp_200607/AbstractURI.php @@ -4,7 +4,7 @@ namespace SimpleSAML\WebServices\Policy\XML\wsp_200607; -use DOMElement; +use Dom\Element; use SimpleSAML\WebServices\Policy\Assert\Assert; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\TypedTextContentTrait; @@ -49,12 +49,12 @@ public function __construct( /** * Convert XML into an wsp:URI type element * - * @param \DOMElement $xml The XML element we should load + * @param \Dom\Element $xml The XML element we should load * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * If the qualified name of the supplied element is wrong */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class); Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); @@ -69,9 +69,9 @@ public static function fromXML(DOMElement $xml): static /** * Convert this wsp:URI type to XML. * - * @param \DOMElement|null $parent The element we should add this wsp:URI to. + * @param \Dom\Element|null $parent The element we should add this wsp:URI to. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = $this->instantiateParentElement($parent); $e->textContent = $this->getContent()->getValue(); diff --git a/src/XML/wsp_200607/AppliesTo.php b/src/XML/wsp_200607/AppliesTo.php index ad4fef1..0a86f86 100644 --- a/src/XML/wsp_200607/AppliesTo.php +++ b/src/XML/wsp_200607/AppliesTo.php @@ -4,7 +4,7 @@ namespace SimpleSAML\WebServices\Policy\XML\wsp_200607; -use DOMElement; +use Dom; use SimpleSAML\WebServices\Policy\Assert\Assert; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; @@ -57,12 +57,12 @@ public function isEmptyElement(): bool /* * Convert XML into an wsp:AppliesTo element * - * @param \DOMElement $xml The XML element we should load + * @param \Dom\Element $xml The XML element we should load * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * If the qualified name of the supplied element is wrong */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, 'AppliesTo', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, AppliesTo::NS, InvalidDOMElementException::class); @@ -77,9 +77,9 @@ public static function fromXML(DOMElement $xml): static /** * Convert this wsp:AppliesTo to XML. * - * @param \DOMElement|null $parent The element we should add this wsp:AppliesTo to. + * @param \Dom\Element|null $parent The element we should add this wsp:AppliesTo to. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = $this->instantiateParentElement($parent); diff --git a/src/XML/wsp_200607/Policy.php b/src/XML/wsp_200607/Policy.php index 6fca69f..e7f05e9 100644 --- a/src/XML/wsp_200607/Policy.php +++ b/src/XML/wsp_200607/Policy.php @@ -4,7 +4,7 @@ namespace SimpleSAML\WebServices\Policy\XML\wsp_200607; -use DOMElement; +use Dom; use SimpleSAML\WebServices\Policy\Assert\Assert; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\SchemaValidatableElementInterface; @@ -90,13 +90,13 @@ final public function isEmptyElement(): bool /* * Convert XML into an wsp:Policy element * - * @param \DOMElement $xml The XML element we should load + * @param \Dom\Element $xml The XML element we should load * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * If the qualified name of the supplied element is wrong */ #[\Override] - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class); Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); @@ -118,9 +118,9 @@ public static function fromXML(DOMElement $xml): static /** * Convert this wsp:Policy to XML. * - * @param \DOMElement|null $parent The element we should add this wsp:Policy to + * @param \Dom\Element|null $parent The element we should add this wsp:Policy to */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = parent::toXML($parent); diff --git a/src/XML/wsp_200607/PolicyAttachment.php b/src/XML/wsp_200607/PolicyAttachment.php index 08fc4b1..22124ba 100644 --- a/src/XML/wsp_200607/PolicyAttachment.php +++ b/src/XML/wsp_200607/PolicyAttachment.php @@ -4,7 +4,7 @@ namespace SimpleSAML\WebServices\Policy\XML\wsp_200607; -use DOMElement; +use Dom; use SimpleSAML\WebServices\Policy\Assert\Assert; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; @@ -93,12 +93,12 @@ public function getPolicies(): array /* * Convert XML into an wsp:PolicyAttachment element * - * @param \DOMElement $xml The XML element we should load + * @param \Dom\Element $xml The XML element we should load * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * If the qualified name of the supplied element is wrong */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class); Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); @@ -125,9 +125,9 @@ public static function fromXML(DOMElement $xml): static /** * Convert this wsp:PolicyAttachment to XML. * - * @param \DOMElement|null $parent The element we should add this wsp:AppliesTo to. + * @param \Dom\Element|null $parent The element we should add this wsp:AppliesTo to. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = $this->instantiateParentElement($parent); diff --git a/src/XML/wsp_200607/PolicyReference.php b/src/XML/wsp_200607/PolicyReference.php index 5d402da..0a9b4a3 100644 --- a/src/XML/wsp_200607/PolicyReference.php +++ b/src/XML/wsp_200607/PolicyReference.php @@ -4,7 +4,7 @@ namespace SimpleSAML\WebServices\Policy\XML\wsp_200607; -use DOMElement; +use Dom; use SimpleSAML\WebServices\Policy\Assert\Assert; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; @@ -92,12 +92,12 @@ public function getDigestAlgorithm(): ?AnyURIValue /* * Convert XML into an wsp:PolicyReference element * - * @param \DOMElement $xml The XML element we should load + * @param \Dom\Element $xml The XML element we should load * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * If the qualified name of the supplied element is wrong */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class); Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); @@ -115,9 +115,9 @@ public static function fromXML(DOMElement $xml): static /** * Convert this wsp:PolicyReference to XML. * - * @param \DOMElement|null $parent The element we should add this wsp:Policy to + * @param \Dom\Element|null $parent The element we should add this wsp:Policy to */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = $this->instantiateParentElement($parent); $e->setAttribute('URI', $this->getURI()->getValue()); diff --git a/tests/Policy/XML/wsp_200409/AllTest.php b/tests/Policy/XML/wsp_200409/AllTest.php index d51c7e6..98bc560 100644 --- a/tests/Policy/XML/wsp_200409/AllTest.php +++ b/tests/Policy/XML/wsp_200409/AllTest.php @@ -62,10 +62,11 @@ public function testMarshalling(): void $this->assertFalse($all->isEmptyElement()); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($all), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($all); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } diff --git a/tests/Policy/XML/wsp_200409/AppliesToTest.php b/tests/Policy/XML/wsp_200409/AppliesToTest.php index 1f4f47b..d6e5ba2 100644 --- a/tests/Policy/XML/wsp_200409/AppliesToTest.php +++ b/tests/Policy/XML/wsp_200409/AppliesToTest.php @@ -52,7 +52,7 @@ public function testMarshalling(): void { $domAttr = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('value1')); - $AppliesTo = new AppliesTo( + $appliesTo = new AppliesTo( [ new EndpointReference( Address::fromString('http://www.fabrikam123.example.com/acct'), @@ -60,12 +60,13 @@ public function testMarshalling(): void ], [$domAttr], ); - $this->assertFalse($AppliesTo->isEmptyElement()); + $this->assertFalse($appliesTo->isEmptyElement()); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($AppliesTo), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($appliesTo); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } diff --git a/tests/Policy/XML/wsp_200409/ExactlyOneTest.php b/tests/Policy/XML/wsp_200409/ExactlyOneTest.php index 3980c26..819d924 100644 --- a/tests/Policy/XML/wsp_200409/ExactlyOneTest.php +++ b/tests/Policy/XML/wsp_200409/ExactlyOneTest.php @@ -62,10 +62,11 @@ public function testMarshalling(): void $this->assertFalse($exactlyOne->isEmptyElement()); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($exactlyOne), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($exactlyOne); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } diff --git a/tests/Policy/XML/wsp_200409/PolicyAttachmentTest.php b/tests/Policy/XML/wsp_200409/PolicyAttachmentTest.php index b185856..a42a7ec 100644 --- a/tests/Policy/XML/wsp_200409/PolicyAttachmentTest.php +++ b/tests/Policy/XML/wsp_200409/PolicyAttachmentTest.php @@ -105,9 +105,10 @@ public function testMarshalling(): void $policyAttachment = new PolicyAttachment($appliesTo, [$policy, $policyReference], [$security, $some], [$attr1]); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($policyAttachment), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($policyAttachment); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/Policy/XML/wsp_200409/PolicyReferenceTest.php b/tests/Policy/XML/wsp_200409/PolicyReferenceTest.php index 25f7903..4b06de3 100644 --- a/tests/Policy/XML/wsp_200409/PolicyReferenceTest.php +++ b/tests/Policy/XML/wsp_200409/PolicyReferenceTest.php @@ -57,16 +57,17 @@ public function testMarshalling(): void { $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('testval1')); - $pr = new PolicyReference( + $policyReference = new PolicyReference( AnyURIValue::fromString('urn:x-simplesamlphp:phpunit'), Base64BinaryValue::fromString('/CTj03d1DB5e2t7CTo9BEzCf5S9NRzwnBgZRlm32REI='), AnyURIValue::fromString('http://schemas.xmlsoap.org/ws/2004/09/policy/Sha1Exc'), [$attr], ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($pr), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($policyReference); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/Policy/XML/wsp_200409/PolicyTest.php b/tests/Policy/XML/wsp_200409/PolicyTest.php index e11c7d5..60e81b3 100644 --- a/tests/Policy/XML/wsp_200409/PolicyTest.php +++ b/tests/Policy/XML/wsp_200409/PolicyTest.php @@ -69,10 +69,11 @@ public function testMarshalling(): void $this->assertFalse($policy->isEmptyElement()); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($policy), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($policy); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } diff --git a/tests/Policy/XML/wsp_200607/AllTest.php b/tests/Policy/XML/wsp_200607/AllTest.php index 113c688..1ee4769 100644 --- a/tests/Policy/XML/wsp_200607/AllTest.php +++ b/tests/Policy/XML/wsp_200607/AllTest.php @@ -62,10 +62,11 @@ public function testMarshalling(): void $this->assertFalse($all->isEmptyElement()); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($all), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($all); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } diff --git a/tests/Policy/XML/wsp_200607/AppliesToTest.php b/tests/Policy/XML/wsp_200607/AppliesToTest.php index b633462..49325c1 100644 --- a/tests/Policy/XML/wsp_200607/AppliesToTest.php +++ b/tests/Policy/XML/wsp_200607/AppliesToTest.php @@ -52,7 +52,7 @@ public function testMarshalling(): void { $domAttr = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('value1')); - $AppliesTo = new AppliesTo( + $appliesTo = new AppliesTo( [ new EndpointReference( Address::fromString('http://www.fabrikam123.example.com/acct'), @@ -60,12 +60,13 @@ public function testMarshalling(): void ], [$domAttr], ); - $this->assertFalse($AppliesTo->isEmptyElement()); + $this->assertFalse($appliesTo->isEmptyElement()); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($AppliesTo), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($appliesTo); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } diff --git a/tests/Policy/XML/wsp_200607/ExactlyOneTest.php b/tests/Policy/XML/wsp_200607/ExactlyOneTest.php index f57f4b0..3a26344 100644 --- a/tests/Policy/XML/wsp_200607/ExactlyOneTest.php +++ b/tests/Policy/XML/wsp_200607/ExactlyOneTest.php @@ -62,10 +62,11 @@ public function testMarshalling(): void $this->assertFalse($exactlyOne->isEmptyElement()); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($exactlyOne), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($exactlyOne); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } diff --git a/tests/Policy/XML/wsp_200607/PolicyAttachmentTest.php b/tests/Policy/XML/wsp_200607/PolicyAttachmentTest.php index baa8c4a..0b2d599 100644 --- a/tests/Policy/XML/wsp_200607/PolicyAttachmentTest.php +++ b/tests/Policy/XML/wsp_200607/PolicyAttachmentTest.php @@ -104,9 +104,10 @@ public function testMarshalling(): void $policyAttachment = new PolicyAttachment($appliesTo, [$policy, $policyReference], [$security, $some], [$attr1]); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($policyAttachment), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($policyAttachment); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/Policy/XML/wsp_200607/PolicyReferenceTest.php b/tests/Policy/XML/wsp_200607/PolicyReferenceTest.php index d5d9b64..7aefec0 100644 --- a/tests/Policy/XML/wsp_200607/PolicyReferenceTest.php +++ b/tests/Policy/XML/wsp_200607/PolicyReferenceTest.php @@ -57,7 +57,7 @@ public function testMarshalling(): void { $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('testval1')); - $pr = new PolicyReference( + $policyReference = new PolicyReference( AnyURIValue::fromString('urn:x-simplesamlphp:phpunit'), Base64BinaryValue::fromString('/CTj03d1DB5e2t7CTo9BEzCf5S9NRzwnBgZRlm32REI='), AnyURIValue::fromString('http://schemas.xmlsoap.org/ws/2004/09/policy/Sha1Exc'), @@ -65,9 +65,10 @@ public function testMarshalling(): void [$attr], ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($pr), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($policyReference); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/Policy/XML/wsp_200607/PolicyTest.php b/tests/Policy/XML/wsp_200607/PolicyTest.php index f676b27..51fdfcc 100644 --- a/tests/Policy/XML/wsp_200607/PolicyTest.php +++ b/tests/Policy/XML/wsp_200607/PolicyTest.php @@ -67,10 +67,11 @@ public function testMarshalling(): void $this->assertFalse($policy->isEmptyElement()); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($policy), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($policy); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } diff --git a/tests/Policy/XML/wsp_200607/URITest.php b/tests/Policy/XML/wsp_200607/URITest.php index e8e1ce8..166eb96 100644 --- a/tests/Policy/XML/wsp_200607/URITest.php +++ b/tests/Policy/XML/wsp_200607/URITest.php @@ -60,9 +60,10 @@ public function testMarshalling(): void $uri = new URI(AnyURIValue::fromString('urn:x-simplesamlphp:namespace'), [$attr]); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($uri), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($uri); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } From 3251394d7c36f6b0228dbb028eb3d7b32c0f51c8 Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Fri, 5 Jun 2026 21:45:27 +0200 Subject: [PATCH 3/3] Migrate DOM-classes to PHP 8.4's new DOM-API --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 3675cb3..3abdc5e 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,7 @@ }, "require-dev": { "simplesamlphp/simplesamlphp-test-framework": "~1.11", - "simplesamlphp/xml-ws-addressing": "~1.3" + "simplesamlphp/xml-ws-addressing": "dev-feature/dom-migration-php84" }, "autoload": { "psr-4": {