Description
PHP 8.5 deprecates calling ord() with a string longer than one byte: https://www.php.net/manual/en/migration85.deprecated.php#migration85.deprecated.standard
Passing a string which is not a single byte to ord() is now deprecated, this is indicative of a bug.
Also, deprecates using null as an array offset: https://www.php.net/manual/en/migration85.deprecated.php#migration85.deprecated.core.using-null-as-an-array-offset
Using null as an array offset or when calling array_key_exists() is now deprecated. Instead an empty string should be used.
Steps to reproduce
- Calling
DER::encodeInteger(256) with php8.5
- Calling
KeySet::get with JWK without kid
Expected behaviour
Code is executed without deprecation warning
Environment
- Version [e.g. 1.0.1] 1.1.1
- Server OS: [e.g. Ubuntu 20.04] Mac OS 15.7.4
- PHP: [version, extensions loaded] 8.5.5
- Packages: [list of packages from composer.json] same as the original one
Backtrace
ord without first byte:
simplejwt/src/SimpleJWT/Util/ASN1/DER.php:289
ord(): Providing a string that is not one byte long is deprecated. Use ord($str[0]) instead
KeySet::get without kid:
simplejwt/src/SimpleJWT/Keys/KeySet.php:327
Using null as an array offset is deprecated, use an empty string instead
Additional information
The official doc for deprecations in php8.5: https://www.php.net/manual/en/migration85.deprecated.php
Description
PHP 8.5 deprecates calling ord() with a string longer than one byte: https://www.php.net/manual/en/migration85.deprecated.php#migration85.deprecated.standard
Also, deprecates using
nullas an array offset: https://www.php.net/manual/en/migration85.deprecated.php#migration85.deprecated.core.using-null-as-an-array-offsetSteps to reproduce
DER::encodeInteger(256)with php8.5KeySet::getwith JWK withoutkidkidis optional according to RFC: https://datatracker.ietf.org/doc/html/rfc7517#section-4.5Expected behaviour
Code is executed without deprecation warning
Environment
Backtrace
ordwithout first byte:KeySet::getwithout kid:Additional information
The official doc for deprecations in php8.5: https://www.php.net/manual/en/migration85.deprecated.php