Skip to content

Commit

Permalink
Removed compatibility layer for PHP <5.3 (since namespaces are suppor…
Browse files Browse the repository at this point in the history
…ted only for 5.3+)
  • Loading branch information
alexerm committed Apr 3, 2015
1 parent 49c55fd commit 7874faa
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 158 deletions.
149 changes: 0 additions & 149 deletions src/XmlSecLibs/Helper.php

This file was deleted.

12 changes: 4 additions & 8 deletions src/XmlSecLibs/XMLSecurityDSig.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ public function __construct() {
$this->sigNode = $sigdoc->documentElement;
}



private function resetXPathObj() {
$this->xPathCtx = NULL;
}
Expand Down Expand Up @@ -180,14 +182,7 @@ private function canonicalizeData($node, $canonicalmethod, $arXPath=NULL, $prefi
$withComments = TRUE;
break;
}
/* Support PHP versions < 5.2 not containing C14N methods in DOM extension */
$php_version = explode('.', PHP_VERSION);
if (($php_version[0] < 5) || ($php_version[0] == 5 && $php_version[1] < 2) ) {
if (! is_null($arXPath)) {
throw new Exception("PHP 5.2.0 or higher is required to perform XPath Transformations");
}
return C14NGeneral($node, $exclusive, $withComments);
}

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

Expand Down Expand Up @@ -808,4 +803,5 @@ public function add509Cert($cert, $isPEMFormat=TRUE, $isURL=False, $options=NULL
public function getValidatedNodes() {
return $this->validatedNodes;
}

}
3 changes: 2 additions & 1 deletion tests/XmlSecLibs/XmlSecEncTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ public function testEncryptNoReplace()
public function verifyProvider()
{
return [
/* [$testName, $testFile] */
['SIGN_TEST', dirname(__FILE__) . '/../sign-basic-test.xml'],
// ['SIGN_TEST_RSA_SHA256', dirname(__FILE__) . '/../sign-sha256-rsa-sha256-test.xml'] // There is no such file in tests folder
];
Expand Down Expand Up @@ -309,7 +310,7 @@ public function testVerify($testName, $testFile)
$objKeyInfo = XMLSecEnc::staticLocateKeyInfo($objKey, $objDSig);

if (!$objKeyInfo->key && empty( $key )) {
$objKey->loadKey(dirname(__FILE__) . '/mycert.pem', true);
$objKey->loadKey(dirname(__FILE__) . '/../mycert.pem', true);
}

$this->assertEquals(1, $objXMLSecDSig->verify($objKey), "$testName: Signature is invalid");
Expand Down

0 comments on commit 7874faa

Please sign in to comment.