Skip to content

Commit c3bf878

Browse files
authored
Merge pull request #38 from PayU-EMEA/add-support-for-php84
Add support for PHP 8.2, 8.3, 8.4 and 8.5
2 parents af16b60 + 9d5e712 commit c3bf878

File tree

4 files changed

+25
-10
lines changed

4 files changed

+25
-10
lines changed

.github/workflows/phpstan.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ jobs:
1818
- 7.4
1919
- 8.0
2020
- 8.1
21+
- 8.2
22+
- 8.3
23+
- 8.4
24+
- 8.5
2125

2226
steps:
2327
- name: Checkout

.github/workflows/phpunit-unit.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ jobs:
1818
- 7.4
1919
- 8.0
2020
- 8.1
21+
- 8.2
22+
- 8.3
23+
- 8.4
24+
- 8.5
2125

2226
steps:
2327
- name: Checkout

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"ext-openssl": "*",
2323
"phpseclib/phpseclib": "^3.0",
2424
"spomky-labs/php-aes-gcm": "^1.2",
25-
"symfony/process": "^4.1|^5.0|^6.0|^7.0"
25+
"symfony/process": "^5.0|^6.0|^7.0"
2626
},
2727
"require-dev": {
2828
"phpunit/phpunit": "^7.5|^9.0",

tests/Decoding/OpenSSL/OpenSslServiceTest.php

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -79,20 +79,27 @@ public function testVerifySignatureFail(): void
7979

8080
public function testGetCertificatesFromPkcs7Success()
8181
{
82-
$leafHeader = 'subject=C = RO, ST = BUH, L = Bucuresti, O = Internet Widgits Pty Ltd, CN = leaflet' .
83-
PHP_EOL . 'issuer=C = RO, ST = BUH, O = PayU, CN = intermediate-cert' . PHP_EOL;
84-
$leafCert = file_get_contents(__DIR__ . '/leaf.crt');
85-
$intermediateHeader = 'subject=C = RO, ST = BUH, O = PayU, CN = intermediate-cert' . PHP_EOL .
86-
'issuer=C = RO, ST = BUH, O = PayU ROOT, CN = root-cert' . PHP_EOL;
87-
$intermediateCert = file_get_contents(__DIR__ . '/intermediate.crt');
88-
89-
$expectedResponse = $leafHeader . $leafCert . PHP_EOL . PHP_EOL . $intermediateHeader . $intermediateCert;
82+
$leafCert = trim(file_get_contents(__DIR__ . '/leaf.crt'));
83+
$intermediateCert = trim(file_get_contents(__DIR__ . '/intermediate.crt'));
9084

9185
$pkcs7DerCert = realpath(__DIR__ . '/leaf.p7b');
9286

9387
$response = $this->openSslService->getCertificatesFromPkcs7($pkcs7DerCert);
9488

95-
$this->assertEquals($expectedResponse, $response);
89+
// Assert subject/issuer headers are present for both certificates.
90+
// OpenSSL < 3.x formats as "C = RO", OpenSSL >= 3.x formats as "C=RO" — accept both.
91+
$this->assertMatchesRegularExpression(
92+
'/^subject=.*CN\s*=\s*leaflet\nissuer=.*CN\s*=\s*intermediate-cert\n/m',
93+
$response
94+
);
95+
$this->assertMatchesRegularExpression(
96+
'/^subject=.*CN\s*=\s*intermediate-cert\nissuer=.*CN\s*=\s*root-cert\n/m',
97+
$response
98+
);
99+
100+
// Assert both PEM certificate bodies are present verbatim.
101+
$this->assertStringContainsString($leafCert, $response);
102+
$this->assertStringContainsString($intermediateCert, $response);
96103
}
97104

98105
public function testGetCertificatesFromPkcs7Fail()

0 commit comments

Comments
 (0)