Skip to content

Commit dc94e45

Browse files
authored
php 8.0 is minimum allowed version (#271)
* php 8.0 is minimum allowed version
1 parent 2b9b05c commit dc94e45

9 files changed

Lines changed: 11 additions & 66 deletions

.github/workflows/ci.yml

Lines changed: 7 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3,50 +3,21 @@ name: Tests
33
on: [push, pull_request]
44

55
jobs:
6-
tests-legacy:
7-
name: PHP ${{ matrix.php-versions }} Tests
8-
runs-on: ${{ matrix.operating-system }}
9-
strategy:
10-
matrix:
11-
operating-system: ['ubuntu-latest']
12-
php-versions: ['5.6']
13-
14-
steps:
15-
- uses: shivammathur/setup-php@v2
16-
with:
17-
php-version: ${{ matrix.php-versions }}
18-
extensions: openssl
19-
tools: phpunit:4.8
20-
21-
- uses: actions/checkout@v3
22-
with:
23-
fetch-depth: 0
246

25-
- name: Install Composer packages
26-
uses: ramsey/composer-install@v3
27-
28-
- name: Run tests
29-
run: phpunit --coverage-clover clover.xml tests
30-
31-
- uses: codecov/codecov-action@v2
32-
with:
33-
token: ${{ secrets.CODECOV_TOKEN }}
34-
files: ./clover.xml
35-
36-
tests-older:
7+
tests-eol:
378
name: PHP ${{ matrix.php-versions }} Tests
389
runs-on: ${{ matrix.operating-system }}
3910
strategy:
4011
matrix:
4112
operating-system: ['ubuntu-latest']
42-
php-versions: ['7.0', '7.1']
13+
php-versions: ['8.0', '8.1']
4314

4415
steps:
4516
- uses: shivammathur/setup-php@v2
4617
with:
4718
php-version: ${{ matrix.php-versions }}
4819
extensions: openssl
49-
tools: phpunit:6.5
20+
tools: phpunit/phpunit:9.6
5021

5122
- uses: actions/checkout@v3
5223
with:
@@ -63,20 +34,20 @@ jobs:
6334
token: ${{ secrets.CODECOV_TOKEN }}
6435
files: ./clover.xml
6536

66-
tests-old:
37+
tests-support:
6738
name: PHP ${{ matrix.php-versions }} Tests
6839
runs-on: ${{ matrix.operating-system }}
6940
strategy:
7041
matrix:
7142
operating-system: ['ubuntu-latest']
72-
php-versions: ['7.2', '7.3', '7.4']
43+
php-versions: ['8.2', '8.3']
7344

7445
steps:
7546
- uses: shivammathur/setup-php@v2
7647
with:
7748
php-version: ${{ matrix.php-versions }}
7849
extensions: openssl
79-
tools: phpunit:8.5
50+
tools: phpunit/phpunit:9.6
8051

8152
- uses: actions/checkout@v3
8253
with:
@@ -99,7 +70,7 @@ jobs:
9970
strategy:
10071
matrix:
10172
operating-system: ['ubuntu-latest']
102-
php-versions: ['8.0', '8.1']
73+
php-versions: ['8.4', '8.5']
10374

10475
steps:
10576
- uses: shivammathur/setup-php@v2

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@ The author of xmlseclibs is Rob Richards.
66

77
# Branches
88
Master is currently the only actively maintained branch.
9-
* master/3.1: Added AES-GCM support requiring 7.1+
9+
* master: requires PHP version 8.0+
10+
* 3.1: Added AES-GCM support requiring 7.1+
1011
* 3.0: Removes mcrypt usage requiring 5.4+ (5.6.24+ recommended for security reasons)
1112
* 2.0: Contains namespace support requiring 5.3+
1213
* 1.4: Contains auto-loader support while also maintaining backwards compatiblity with the older 1.3 version using the xmlseclibs.php file. Supports PHP 5.2+
1314

1415
# Requirements
1516

16-
xmlseclibs requires PHP version 5.4 or greater. **5.6.24+ recommended for security reasons**
17+
xmlseclibs requires PHP version 8.0 or greater.
1718

1819

1920
## How to Install

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
}
1616
},
1717
"require": {
18-
"php": ">= 5.6.1",
18+
"php": ">= 8.0",
1919
"ext-openssl": "*",
2020
"phpseclib/phpseclib": "~3.0"
2121
}

src/XMLSecurityKey.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -440,9 +440,6 @@ private function encryptSymmetric($data)
440440
$this->iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length($this->cryptParams['cipher']));
441441
$authTag = null;
442442
if(in_array($this->cryptParams['cipher'], ['aes-128-gcm', 'aes-192-gcm', 'aes-256-gcm'])) {
443-
if (version_compare(PHP_VERSION, '7.1.0') < 0) {
444-
throw new Exception('PHP 7.1.0 is required to use AES GCM algorithms');
445-
}
446443
$authTag = openssl_random_pseudo_bytes(self::AUTHTAG_LENGTH);
447444
$encrypted = openssl_encrypt($data, $this->cryptParams['cipher'], $this->key, OPENSSL_RAW_DATA, $this->iv, $authTag);
448445
} else {
@@ -469,9 +466,6 @@ private function decryptSymmetric($data)
469466
$data = substr($data, $iv_length);
470467
$authTag = null;
471468
if(in_array($this->cryptParams['cipher'], ['aes-128-gcm', 'aes-192-gcm', 'aes-256-gcm'])) {
472-
if (version_compare(PHP_VERSION, '7.1.0') < 0) {
473-
throw new Exception('PHP 7.1.0 is required to use AES GCM algorithms');
474-
}
475469
// obtain and remove the authentication tag
476470
$offset = 0 - self::AUTHTAG_LENGTH;
477471
$authTag = substr($data, $offset);

tests/saml/saml-decrypt.phpt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,6 @@ Basic Decryption
55
require(dirname(__FILE__) . '/../../xmlseclibs.php');
66
use RobRichards\XMLSecLibs\XMLSecEnc;
77

8-
// Travis not honoring SKIPIF
9-
if (version_compare(PHP_VERSION, '7.1.0') < 0) {
10-
print "KYzsRqRzQY5qp+bv9T8bHA/AvsI=\n";
11-
exit;
12-
}
13-
148
/* When we need to locate our own key based on something like a key name */
159
function locateLocalKey($objKey) {
1610
/* In this example the key is identified by filename */

tests/xml-sign-sha256-rsa-sha256.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
--TEST--
22
Signature RSA SHA256
3-
--SKIPIF--
4-
<?php if (version_compare(PHP_VERSION, '5.3.0', '<')) die('SKIP Requires PHP version 5.3.0 or newer.'); ?>
53
--FILE--
64
<?php
75
require(dirname(__FILE__) . '/../xmlseclibs.php');

tests/xmlsec-decrypt.phpt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,6 @@ foreach ($arTests AS $testName=>$testFile) {
2525
$output = NULL;
2626
print "$testName: ";
2727

28-
// Skip AES tests is PHP < 7.1.0
29-
if ((substr($testName, 0, 3) === "AES") && (version_compare(PHP_VERSION, '7.1.0') < 0)) {
30-
print "Passed\n";
31-
continue;
32-
}
33-
3428
$doc->load(dirname(__FILE__) . "/$testFile");
3529

3630
try {

tests/xmlsec-encrypt-aes-gmc.phpt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,6 @@ foreach ($arTests AS $testName=>$testParams) {
1919
}
2020

2121
print "$testName: ";
22-
// Travis not honoring SKIPIF
23-
if (version_compare(PHP_VERSION, '7.1.0') < 0) {
24-
print "EncryptedData\n";
25-
continue;
26-
}
2722

2823
$dom = new DOMDocument();
2924
$dom->load(dirname(__FILE__) . '/basic-doc.xml');

tests/xmlsec-verify-rsa-sha256.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
--TEST--
22
Verify RSA SHA256
3-
--SKIPIF--
4-
<?php if (version_compare(PHP_VERSION, '5.3.0', '<')) die('SKIP Requires PHP version 5.3.0 or newer.'); ?>
53
--FILE--
64
<?php
75
require(dirname(__FILE__) . '/../xmlseclibs.php');

0 commit comments

Comments
 (0)