mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-21 00:07:30 +00:00
Move PHP minimum to 8.0
This commit is contained in:
parent
09eac0e129
commit
2b5667a56b
17
.github/workflows/main.yml
vendored
17
.github/workflows/main.yml
vendored
@ -13,7 +13,7 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
image: [ubuntu-20.04]
|
||||
php: [7.4.20, 8.0.7]
|
||||
php: [8.0.7]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2 #needed for build.sh
|
||||
@ -36,13 +36,8 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- php: 8.0.7
|
||||
config: phpstan.neon.dist
|
||||
image: ubuntu-20.04
|
||||
- php: 7.4.20
|
||||
config: phpstan.php7.neon
|
||||
image: ubuntu-20.04
|
||||
image: [ubuntu-20.04]
|
||||
php: [8.0.7]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
@ -92,7 +87,7 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
image: [ubuntu-20.04]
|
||||
php: [7.4.20, 8.0.7]
|
||||
php: [8.0.7]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
@ -144,7 +139,7 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
image: [ubuntu-20.04]
|
||||
php: [7.4.20, 8.0.7]
|
||||
php: [8.0.7]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
@ -196,7 +191,7 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
image: [ubuntu-20.04]
|
||||
php: [7.4.20, 8.0.7]
|
||||
php: [8.0.7]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
@ -5,7 +5,7 @@
|
||||
"homepage": "https://pmmp.io",
|
||||
"license": "LGPL-3.0",
|
||||
"require": {
|
||||
"php": "^7.4 || ^8.0",
|
||||
"php": "^8.0",
|
||||
"php-64bit": "*",
|
||||
"ext-chunkutils2": "^0.2.0",
|
||||
"ext-crypto": "^0.3.1",
|
||||
@ -74,7 +74,7 @@
|
||||
},
|
||||
"config": {
|
||||
"platform": {
|
||||
"php": "7.4.0"
|
||||
"php": "8.0.0"
|
||||
},
|
||||
"sort-packages": true
|
||||
},
|
||||
|
35
composer.lock
generated
35
composer.lock
generated
@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "49005f17832ef5949b4a2ac04cd1ee93",
|
||||
"content-hash": "a6269c62c36da26e5e628322bdcdbb51",
|
||||
"packages": [
|
||||
{
|
||||
"name": "adhocore/json-comment",
|
||||
@ -268,7 +268,7 @@
|
||||
"ramsey/uuid": "^4.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpstan/phpstan": "0.12.92",
|
||||
"phpstan/phpstan": "0.12.93",
|
||||
"phpstan/phpstan-phpunit": "^0.12.21",
|
||||
"phpstan/phpstan-strict-rules": "^0.12.10",
|
||||
"phpunit/phpunit": "^9.5"
|
||||
@ -289,7 +289,7 @@
|
||||
"issues": "https://github.com/pmmp/BedrockProtocol/issues",
|
||||
"source": "https://github.com/pmmp/BedrockProtocol/tree/master"
|
||||
},
|
||||
"time": "2021-07-14T19:29:34+00:00"
|
||||
"time": "2021-07-23T22:10:41+00:00"
|
||||
},
|
||||
{
|
||||
"name": "pocketmine/binaryutils",
|
||||
@ -1522,16 +1522,16 @@
|
||||
},
|
||||
{
|
||||
"name": "nikic/php-parser",
|
||||
"version": "v4.11.0",
|
||||
"version": "v4.12.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/nikic/PHP-Parser.git",
|
||||
"reference": "fe14cf3672a149364fb66dfe11bf6549af899f94"
|
||||
"reference": "6608f01670c3cc5079e18c1dab1104e002579143"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/fe14cf3672a149364fb66dfe11bf6549af899f94",
|
||||
"reference": "fe14cf3672a149364fb66dfe11bf6549af899f94",
|
||||
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/6608f01670c3cc5079e18c1dab1104e002579143",
|
||||
"reference": "6608f01670c3cc5079e18c1dab1104e002579143",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -1572,22 +1572,22 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/nikic/PHP-Parser/issues",
|
||||
"source": "https://github.com/nikic/PHP-Parser/tree/v4.11.0"
|
||||
"source": "https://github.com/nikic/PHP-Parser/tree/v4.12.0"
|
||||
},
|
||||
"time": "2021-07-03T13:36:55+00:00"
|
||||
"time": "2021-07-21T10:44:31+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phar-io/manifest",
|
||||
"version": "2.0.1",
|
||||
"version": "2.0.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phar-io/manifest.git",
|
||||
"reference": "85265efd3af7ba3ca4b2a2c34dbfc5788dd29133"
|
||||
"reference": "97803eca37d319dfa7826cc2437fc020857acb53"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phar-io/manifest/zipball/85265efd3af7ba3ca4b2a2c34dbfc5788dd29133",
|
||||
"reference": "85265efd3af7ba3ca4b2a2c34dbfc5788dd29133",
|
||||
"url": "https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53",
|
||||
"reference": "97803eca37d319dfa7826cc2437fc020857acb53",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -1632,9 +1632,9 @@
|
||||
"description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)",
|
||||
"support": {
|
||||
"issues": "https://github.com/phar-io/manifest/issues",
|
||||
"source": "https://github.com/phar-io/manifest/tree/master"
|
||||
"source": "https://github.com/phar-io/manifest/tree/2.0.3"
|
||||
},
|
||||
"time": "2020-06-27T14:33:11+00:00"
|
||||
"time": "2021-07-20T11:28:43+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phar-io/version",
|
||||
@ -3354,6 +3354,7 @@
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"abandoned": true,
|
||||
"time": "2020-09-28T06:45:17+00:00"
|
||||
},
|
||||
{
|
||||
@ -3526,7 +3527,7 @@
|
||||
"prefer-stable": false,
|
||||
"prefer-lowest": false,
|
||||
"platform": {
|
||||
"php": "^7.4 || ^8.0",
|
||||
"php": "^8.0",
|
||||
"php-64bit": "*",
|
||||
"ext-chunkutils2": "^0.2.0",
|
||||
"ext-crypto": "^0.3.1",
|
||||
@ -3555,7 +3556,7 @@
|
||||
},
|
||||
"platform-dev": [],
|
||||
"platform-overrides": {
|
||||
"php": "7.4.0"
|
||||
"php": "8.0.0"
|
||||
},
|
||||
"plugin-api-version": "2.1.0"
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ includes:
|
||||
- tests/phpstan/configs/impossible-generics.neon
|
||||
- tests/phpstan/configs/l7-baseline.neon
|
||||
- tests/phpstan/configs/l8-baseline.neon
|
||||
- tests/phpstan/configs/php74-compat.neon
|
||||
- tests/phpstan/configs/php-bugs.neon
|
||||
- tests/phpstan/configs/phpstan-bugs.neon
|
||||
- tests/phpstan/configs/phpunit-wiring-tests.neon
|
||||
@ -57,6 +56,3 @@ parameters:
|
||||
#we'll just fill it with 10 - it's very unlikely to encounter a callable with 10 parameters anyway.
|
||||
anyCallable: 'callable(mixed, mixed, mixed, mixed, mixed, mixed, mixed, mixed, mixed, mixed) : mixed'
|
||||
anyClosure: '\Closure(mixed, mixed, mixed, mixed, mixed, mixed, mixed, mixed, mixed, mixed) : mixed'
|
||||
PhpSocket: '\Socket'
|
||||
PhpCurlHandle: '\CurlHandle'
|
||||
PhpOpenSSLAsymmetricKey: '\OpenSSLAsymmetricKey'
|
||||
|
@ -1,10 +0,0 @@
|
||||
includes:
|
||||
- phpstan.neon.dist
|
||||
- tests/phpstan/configs/php7.neon
|
||||
|
||||
parameters:
|
||||
phpVersion: 70400
|
||||
typeAliases:
|
||||
PhpSocket: resource
|
||||
PhpCurlHandle: resource
|
||||
PhpOpenSSLAsymmetricKey: resource
|
@ -43,7 +43,7 @@ namespace pocketmine {
|
||||
|
||||
require_once __DIR__ . '/VersionInfo.php';
|
||||
|
||||
const MIN_PHP_VERSION = "7.4.0";
|
||||
const MIN_PHP_VERSION = "8.0.0";
|
||||
|
||||
/**
|
||||
* @param string $message
|
||||
|
@ -97,12 +97,9 @@ final class JwtUtils{
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \OpenSSLAsymmetricKey|resource $signingKey
|
||||
* @phpstan-param PhpOpenSSLAsymmetricKey $signingKey
|
||||
*
|
||||
* @throws JwtException
|
||||
*/
|
||||
public static function verify(string $jwt, $signingKey) : bool{
|
||||
public static function verify(string $jwt, \OpenSSLAsymmetricKey $signingKey) : bool{
|
||||
[$header, $body, $signature] = self::split($jwt);
|
||||
|
||||
$plainSignature = self::b64UrlDecode($signature);
|
||||
@ -133,13 +130,10 @@ final class JwtUtils{
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \OpenSSLAsymmetricKey|resource $signingKey
|
||||
* @phpstan-param PhpOpenSSLAsymmetricKey $signingKey
|
||||
*
|
||||
* @phpstan-param array<string, mixed> $header
|
||||
* @phpstan-param array<string, mixed> $claims
|
||||
*/
|
||||
public static function create(array $header, array $claims, $signingKey) : string{
|
||||
public static function create(array $header, array $claims, \OpenSSLAsymmetricKey $signingKey) : string{
|
||||
$jwtBody = JwtUtils::b64UrlEncode(json_encode($header, JSON_THROW_ON_ERROR)) . "." . JwtUtils::b64UrlEncode(json_encode($claims, JSON_THROW_ON_ERROR));
|
||||
|
||||
openssl_sign(
|
||||
@ -190,11 +184,7 @@ final class JwtUtils{
|
||||
return $decoded;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \OpenSSLAsymmetricKey|resource $opensslKey
|
||||
* @phpstan-param PhpOpenSSLAsymmetricKey $opensslKey
|
||||
*/
|
||||
public static function emitDerPublicKey($opensslKey) : string{
|
||||
public static function emitDerPublicKey(\OpenSSLAsymmetricKey $opensslKey) : string{
|
||||
$details = openssl_pkey_get_details($opensslKey);
|
||||
if($details === false){
|
||||
throw new AssumptionFailedError("Failed to get details from OpenSSL key resource");
|
||||
@ -211,11 +201,7 @@ final class JwtUtils{
|
||||
throw new AssumptionFailedError("OpenSSL resource contains invalid public key");
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \OpenSSLAsymmetricKey|resource
|
||||
* @phpstan-return PhpOpenSSLAsymmetricKey
|
||||
*/
|
||||
public static function parseDerPublicKey(string $derKey){
|
||||
public static function parseDerPublicKey(string $derKey) : \OpenSSLAsymmetricKey{
|
||||
$signingKeyOpenSSL = openssl_pkey_get_public(sprintf("-----BEGIN PUBLIC KEY-----\n%s\n-----END PUBLIC KEY-----\n", base64_encode($derKey)));
|
||||
if($signingKeyOpenSSL === false){
|
||||
throw new JwtException("OpenSSL failed to parse key: " . openssl_error_string());
|
||||
|
@ -40,13 +40,7 @@ final class EncryptionUtils{
|
||||
//NOOP
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \OpenSSLAsymmetricKey|resource $localPriv
|
||||
* @param \OpenSSLAsymmetricKey|resource $remotePub
|
||||
* @phpstan-param PhpOpenSSLAsymmetricKey $localPriv
|
||||
* @phpstan-param PhpOpenSSLAsymmetricKey $remotePub
|
||||
*/
|
||||
public static function generateSharedSecret($localPriv, $remotePub) : \GMP{
|
||||
public static function generateSharedSecret(\OpenSSLAsymmetricKey $localPriv, \OpenSSLAsymmetricKey $remotePub) : \GMP{
|
||||
$hexSecret = openssl_pkey_derive($remotePub, $localPriv, 48);
|
||||
if($hexSecret === false){
|
||||
throw new \InvalidArgumentException("Failed to derive shared secret: " . openssl_error_string());
|
||||
@ -58,11 +52,7 @@ final class EncryptionUtils{
|
||||
return openssl_digest($salt . hex2bin(str_pad(gmp_strval($secret, 16), 96, "0", STR_PAD_LEFT)), 'sha256', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \OpenSSLAsymmetricKey|resource $serverPriv
|
||||
* @phpstan-param PhpOpenSSLAsymmetricKey $serverPriv
|
||||
*/
|
||||
public static function generateServerHandshakeJwt($serverPriv, string $salt) : string{
|
||||
public static function generateServerHandshakeJwt(\OpenSSLAsymmetricKey $serverPriv, string $salt) : string{
|
||||
$derPublicKey = JwtUtils::emitDerPublicKey($serverPriv);
|
||||
return JwtUtils::create(
|
||||
[
|
||||
|
@ -38,11 +38,7 @@ class PrepareEncryptionTask extends AsyncTask{
|
||||
|
||||
private const TLS_KEY_ON_COMPLETION = "completion";
|
||||
|
||||
/**
|
||||
* @var \OpenSSLAsymmetricKey|resource|null
|
||||
* @phpstan-var PhpOpenSSLAsymmetricKey|null
|
||||
*/
|
||||
private static $SERVER_PRIVATE_KEY = null;
|
||||
private static ?\OpenSSLAsymmetricKey $SERVER_PRIVATE_KEY = null;
|
||||
|
||||
/** @var string */
|
||||
private $serverPrivateKey;
|
||||
|
@ -63,11 +63,7 @@ final class DedicatedQueryNetworkInterface implements AdvancedNetworkInterface{
|
||||
private $port;
|
||||
/** @var \Logger */
|
||||
private $logger;
|
||||
/**
|
||||
* @var \Socket|resource
|
||||
* @phpstan-var PhpSocket
|
||||
*/
|
||||
private $socket;
|
||||
private \Socket $socket;
|
||||
/** @var Network */
|
||||
private $network;
|
||||
/**
|
||||
|
@ -185,7 +185,7 @@ class Internet{
|
||||
* @param \Closure|null $onSuccess function to be called if there is no error. Accepts a resource argument as the cURL handle.
|
||||
* @phpstan-param array<int, mixed> $extraOpts
|
||||
* @phpstan-param list<string> $extraHeaders
|
||||
* @phpstan-param (\Closure(PhpCurlHandle) : void)|null $onSuccess
|
||||
* @phpstan-param (\Closure(\CurlHandle) : void)|null $onSuccess
|
||||
*
|
||||
* @throws InternetException if a cURL error occurs
|
||||
*/
|
||||
|
@ -193,9 +193,6 @@ abstract class Timezone{
|
||||
}
|
||||
|
||||
$parsed = date_parse($offset);
|
||||
if($parsed === false){
|
||||
return false;
|
||||
}
|
||||
$offset = $parsed['hour'] * 3600 + $parsed['minute'] * 60 + $parsed['second'];
|
||||
|
||||
//After date_parse is done, put the sign back
|
||||
|
@ -470,9 +470,7 @@ final class Utils{
|
||||
}
|
||||
preg_match_all('/(*ANYCRLF)^[\t ]*(?:\* )?@([a-zA-Z]+)(?:[\t ]+(.+?))?[\t ]*$/m', $rawDocComment, $matches);
|
||||
|
||||
$result = array_combine($matches[1], $matches[2]);
|
||||
if($result === false) throw new AssumptionFailedError("array_combine() doesn't return false with two equal-sized arrays");
|
||||
return $result;
|
||||
return array_combine($matches[1], $matches[2]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,67 +0,0 @@
|
||||
parameters:
|
||||
ignoreErrors:
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$fp of function fclose expects resource, resource\\|false given\\.$#"
|
||||
count: 1
|
||||
path: ../../../src/MemoryManager.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$fp of function fwrite expects resource, resource\\|false given\\.$#"
|
||||
count: 1
|
||||
path: ../../../src/MemoryManager.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$str of function strtolower expects string, mixed given\\.$#"
|
||||
count: 1
|
||||
path: ../../../src/ServerConfigGroup.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$fp of function fclose expects resource, resource\\|false given\\.$#"
|
||||
count: 2
|
||||
path: ../../../src/command/defaults/TimingsCommand.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$fp of function fseek expects resource, resource\\|false given\\.$#"
|
||||
count: 1
|
||||
path: ../../../src/command/defaults/TimingsCommand.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$fp of function fwrite expects resource, resource\\|false given\\.$#"
|
||||
count: 1
|
||||
path: ../../../src/command/defaults/TimingsCommand.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$source of function stream_get_contents expects resource, resource\\|false given\\.$#"
|
||||
count: 1
|
||||
path: ../../../src/command/defaults/TimingsCommand.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$argument of class ReflectionClass constructor expects class\\-string\\<T of object\\>\\|T of object, string given\\.$#"
|
||||
count: 1
|
||||
path: ../../../src/event/HandlerListManager.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#2 \\$input1 of function array_map expects array, array\\|false given\\.$#"
|
||||
count: 1
|
||||
path: ../../../src/lang/Language.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#2 \\$start of function substr expects int, mixed given\\.$#"
|
||||
count: 1
|
||||
path: ../../../src/utils/Internet.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#3 \\$length of function substr expects int, mixed given\\.$#"
|
||||
count: 1
|
||||
path: ../../../src/utils/Internet.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$timezone_identifier of function date_default_timezone_set expects string, string\\|false given\\.$#"
|
||||
count: 1
|
||||
path: ../../../src/utils/Timezone.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#2 \\$input1 of function array_map expects array, mixed given\\.$#"
|
||||
count: 1
|
||||
path: ../../../src/utils/Utils.php
|
||||
|
@ -1,12 +0,0 @@
|
||||
parameters:
|
||||
ignoreErrors:
|
||||
-
|
||||
message: "#^Strict comparison using \\=\\=\\= between array\\<string, mixed\\> and false will always evaluate to false\\.$#"
|
||||
count: 1
|
||||
path: ../../../src/utils/Timezone.php
|
||||
|
||||
-
|
||||
message: "#^Strict comparison using \\=\\=\\= between array and false will always evaluate to false\\.$#"
|
||||
count: 1
|
||||
path: ../../../src/utils/Utils.php
|
||||
|
Loading…
x
Reference in New Issue
Block a user