Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#10609 - fix decryption XML replacement for PHP 8.x #563

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/Saml2/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,18 @@ public static function treeCopyReplace(DomNode $targetNode, DomNode $sourceNode,
throw new Exception('Illegal argument targetNode. It has no parentNode.');
}
$clonedNode = $targetNode->ownerDocument->importNode($sourceNode, false);
$ns = $clonedNode->prefix;
if ($recurse) {
$resultNode = $targetNode->appendChild($clonedNode);
} else {
$resultNode = $targetNode->parentNode->insertBefore($clonedNode, $targetNode);
}
// PHP 8.x can change the NS to that of the parent when
// adding a child node. This puts it back because we are
// merging as is and should not be changed
if ($resultNode->prefix !== $ns) {
$resultNode->prefix = $ns;
}
if ($sourceNode->childNodes !== null) {
foreach ($sourceNode->childNodes as $child) {
self::treeCopyReplace($resultNode, $child, true);
Expand Down
Loading