Skip to content

Commit eb7a01d

Browse files
committed
Fix PHP 8.5 compatibility
* ord(): pass the first byte explicitly in encodeInteger(). PHP 8.5 deprecates calling ord() with a string longer than one byte. * CI: add PHP 8.5 to the phpunit matrix.
1 parent 0ec48e4 commit eb7a01d

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ jobs:
1414
- 8.2
1515
- 8.3
1616
- 8.4
17+
- 8.5
1718
steps:
1819
- name: Checkout
1920
uses: actions/checkout@v4

src/SimpleJWT/Util/ASN1/DER.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ static function encodeInteger($int) {
286286
$data = gmp_export($int);
287287

288288
if (strlen($data) == 0) return "\0";
289-
if (ord($data) > 127) return "\0" . $data;
289+
if (ord($data[0]) > 127) return "\0" . $data;
290290
return $data;
291291
}
292292

0 commit comments

Comments
 (0)