Skip to content

Commit

Permalink
Merge pull request #1 from alphacomm/merge-upstream-fixes
Browse files Browse the repository at this point in the history
Merge upstream commit 97e4671
  • Loading branch information
alexerm committed May 20, 2015
2 parents 8c621e5 + a3047f6 commit 61ed937
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions src/XmlSecLibs/XMLSecurityDSig.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* xmlseclibs.php
*
* Copyright (c) 2007-2013, Robert Richards <rrichards@cdatazone.org>.
* Copyright (c) 2007-2015, Robert Richards <rrichards@cdatazone.org>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -35,7 +35,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*
* @author Robert Richards <rrichards@cdatazone.org>
* @copyright 2007-2013 Robert Richards <rrichards@cdatazone.org>
* @copyright 2007-2015 Robert Richards <rrichards@cdatazone.org>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version 1.3.2-dev
*/
Expand Down Expand Up @@ -265,6 +265,25 @@ private function canonicalizeData(DOMNode $node, $canonicalMethod, $arXPath = nu
break;
}

if (
is_null($arXPath) &&
($node instanceof DOMNode) &&
($node->ownerDocument !== null) &&
$node->isSameNode($node->ownerDocument->documentElement)
) {
/* Check for any PI or comments as they would have been excluded */
$element = $node;
while ($refnode = $element->previousSibling) {
if ($refnode->nodeType == XML_PI_NODE || (($refnode->nodeType == XML_COMMENT_NODE) && $withComments)) {
break;
}
$element = $refnode;
}
if ($refnode == null) {
$node = $node->ownerDocument;
}
}

return $node->C14N($exclusive, $withComments, $arXPath, $prefixList);
}

Expand Down

0 comments on commit 61ed937

Please sign in to comment.