Merge remote-tracking branch 'origin/stable'

This commit is contained in:
Dylan K. Taylor 2021-07-23 16:40:19 +01:00
commit 58498c2b0b
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
8 changed files with 221 additions and 27 deletions

View File

@ -20,8 +20,9 @@ assignees: ''
<!-- try the `version` command | LATEST IS NOT A VALID VERSION -->
* PocketMine-MP:
* PHP:
* Using JIT: yes/no (delete as appropriate) <!-- look for the giant yellow warning in the log that says you're using JIT -->
* Server OS:
* Game version: PE/Win10 (delete as appropriate)
* Game version: Android/iOS/Win10/Xbox/PS4/Switch (delete as appropriate)
### Plugins
<!--- use the `plugins` command and paste the output below -->

View File

@ -13,7 +13,7 @@ jobs:
strategy:
matrix:
image: [ubuntu-20.04]
php: [7.4.20]
php: [7.4.20, 8.0.7]
steps:
- uses: actions/checkout@v2 #needed for build.sh
@ -36,8 +36,13 @@ jobs:
strategy:
fail-fast: false
matrix:
image: [ubuntu-20.04]
php: [7.4.20]
include:
- php: 8.0.7
config: phpstan.php8.neon
image: ubuntu-20.04
- php: 7.4.20
config: phpstan.neon.dist
image: ubuntu-20.04
steps:
- uses: actions/checkout@v2
@ -77,7 +82,7 @@ jobs:
run: php composer.phar install --prefer-dist --no-interaction
- name: Run PHPStan
run: ./vendor/bin/phpstan analyze --no-progress --memory-limit=2G
run: ./vendor/bin/phpstan analyze --no-progress --memory-limit=2G -c ${{ matrix.config }}
phpunit:
name: PHPUnit tests
@ -87,7 +92,7 @@ jobs:
fail-fast: false
matrix:
image: [ubuntu-20.04]
php: [7.4.20]
php: [7.4.20, 8.0.7]
steps:
- uses: actions/checkout@v2
@ -139,7 +144,7 @@ jobs:
fail-fast: false
matrix:
image: [ubuntu-20.04]
php: [7.4.20]
php: [7.4.20, 8.0.7]
steps:
- uses: actions/checkout@v2
@ -191,7 +196,7 @@ jobs:
fail-fast: false
matrix:
image: [ubuntu-20.04]
php: [7.4.20]
php: [7.4.20, 8.0.7]
steps:
- uses: actions/checkout@v2
@ -276,7 +281,7 @@ jobs:
- name: Setup PHP and tools
uses: shivammathur/setup-php@2.9.0
with:
php-version: 7.4
php-version: 8.0
tools: php-cs-fixer
- name: Run PHP-CS-Fixer

View File

@ -9,3 +9,12 @@ Plugin developers should **only** update their required API to this version if y
# 3.22.0
- Added support for Minecraft: Bedrock Edition 1.17.10.
- Removed compatibility with earlier versions.
# 3.22.1
- Added a giant yellow startup warning if using OPcache JIT on PHP 8.0. JIT is currently considered highly unstable and not recommended for production use.
- When using a bad PHP binary, the bootstrap will now report the used `php.ini` path. This can be useful for debugging issues with extension loading when the wrong `php.ini` file is loaded for some reason.
- Fixed `start.cmd` causing the wrong `php.ini` to be loaded on Windows when a global PHP installation is used.
- A debug message is now logged containing expected vs. actual XUID of players when an XUID mismatch is detected.
- Improved the documentation for `Player->getUniqueId()`.
- Fixed a mistake in the documentation of `PlayerAuthInputFlags`.
- Fixed incorrect encoding of `NpcDialoguePacket`.

12
composer.lock generated
View File

@ -2400,16 +2400,16 @@
},
{
"name": "phpunit/phpunit",
"version": "9.5.6",
"version": "9.5.7",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "fb9b8333f14e3dce976a60ef6a7e05c7c7ed8bfb"
"reference": "d0dc8b6999c937616df4fb046792004b33fd31c5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/fb9b8333f14e3dce976a60ef6a7e05c7c7ed8bfb",
"reference": "fb9b8333f14e3dce976a60ef6a7e05c7c7ed8bfb",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/d0dc8b6999c937616df4fb046792004b33fd31c5",
"reference": "d0dc8b6999c937616df4fb046792004b33fd31c5",
"shasum": ""
},
"require": {
@ -2487,7 +2487,7 @@
],
"support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.6"
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.7"
},
"funding": [
{
@ -2499,7 +2499,7 @@
"type": "github"
}
],
"time": "2021-06-23T05:14:38+00:00"
"time": "2021-07-19T06:14:47+00:00"
},
{
"name": "sebastian/cli-parser",

4
phpstan.php8.neon Normal file
View File

@ -0,0 +1,4 @@
includes:
- phpstan.neon.dist
- tests/phpstan/configs/php8.neon

View File

@ -605,6 +605,7 @@ class NetworkSession{
$myXUID = $this->info instanceof XboxLivePlayerInfo ? $this->info->getXuid() : "";
$kickForXUIDMismatch = function(string $xuid) use ($checkXUID, $myXUID) : bool{
if($checkXUID && $myXUID !== $xuid){
$this->logger->debug("XUID mismatch: expected '$xuid', but got '$myXUID'");
//TODO: Longer term, we should be identifying playerdata using something more reliable, like XUID or UUID.
//However, that would be a very disruptive change, so this will serve as a stopgap for now.
//Side note: this will also prevent offline players hijacking XBL playerdata on online servers, since their

View File

@ -376,19 +376,11 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
}
/**
* Returns the player's UUID. This should be preferred over their Xbox user ID (XUID) because UUID is a standard
* format which will never change, and all players will have one regardless of whether they are logged into Xbox
* Live.
* Returns the player's UUID. This should be the preferred method to identify a player.
* It does not change if the player changes their username.
*
* The UUID is comprised of:
* - when logged into XBL: a hash of their XUID (and as such will not change for the lifetime of the XBL account)
* - when NOT logged into XBL: a hash of their name + clientID + secret device ID.
*
* WARNING: UUIDs of players **not logged into Xbox Live** CAN BE FAKED and SHOULD NOT be trusted!
*
* (In the olden days this method used to return a fake UUID computed by the server, which was used by plugins such
* as SimpleAuth for authentication. This is NOT SAFE anymore as this UUID is now what was given by the client, NOT
* a server-computed UUID.)
* All players will have a UUID, regardless of whether they are logged into Xbox Live or not. However, note that
* non-XBL players can fake their UUIDs.
*/
public function getUniqueId() : UuidInterface{
return parent::getUniqueId();

View File

@ -0,0 +1,182 @@
parameters:
ignoreErrors:
-
message: "#^Parameter \\#1 \\$stream of function fclose expects resource, resource\\|false given\\.$#"
count: 1
path: ../../../src/MemoryManager.php
-
message: "#^Parameter \\#1 \\$stream of function fwrite expects resource, resource\\|false given\\.$#"
count: 1
path: ../../../src/MemoryManager.php
-
message: "#^Parameter \\#1 \\$string of function strtolower expects string, mixed given\\.$#"
count: 1
path: ../../../src/ServerConfigGroup.php
-
message: "#^Parameter \\#1 \\$stream of function fclose expects resource, resource\\|false given\\.$#"
count: 2
path: ../../../src/command/defaults/TimingsCommand.php
-
message: "#^Parameter \\#1 \\$stream of function fseek expects resource, resource\\|false given\\.$#"
count: 1
path: ../../../src/command/defaults/TimingsCommand.php
-
message: "#^Parameter \\#1 \\$stream of function fwrite expects resource, resource\\|false given\\.$#"
count: 1
path: ../../../src/command/defaults/TimingsCommand.php
-
message: "#^Parameter \\#1 \\$stream of function stream_get_contents expects resource, resource\\|false given\\.$#"
count: 1
path: ../../../src/command/defaults/TimingsCommand.php
-
message: "#^Parameter \\#1 \\$objectOrClass 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 \\$array of function array_map expects array, array\\|false given\\.$#"
count: 1
path: ../../../src/lang/Language.php
-
message: "#^Method pocketmine\\\\network\\\\mcpe\\\\JwtUtils\\:\\:parseDerPublicKey\\(\\) should return resource but returns OpenSSLAsymmetricKey\\.$#"
count: 1
path: ../../../src/network/mcpe/JwtUtils.php
-
message: "#^Parameter \\#1 \\$key of function openssl_pkey_get_details expects OpenSSLAsymmetricKey, resource given\\.$#"
count: 1
path: ../../../src/network/mcpe/JwtUtils.php
-
message: "#^Parameter \\#3 \\$private_key of function openssl_sign expects array\\|OpenSSLAsymmetricKey\\|OpenSSLCertificate\\|string, resource given\\.$#"
count: 1
path: ../../../src/network/mcpe/JwtUtils.php
-
message: "#^Parameter \\#3 \\$public_key of function openssl_verify expects array\\|OpenSSLAsymmetricKey\\|OpenSSLCertificate\\|string, resource given\\.$#"
count: 1
path: ../../../src/network/mcpe/JwtUtils.php
-
message: "#^Parameter \\#1 \\$key of function openssl_free_key expects OpenSSLAsymmetricKey, resource given\\.$#"
count: 1
path: ../../../src/network/mcpe/auth/ProcessLoginTask.php
-
message: "#^Parameter \\#1 \\$public_key of function openssl_pkey_derive expects array\\|OpenSSLAsymmetricKey\\|OpenSSLCertificate\\|string, resource given\\.$#"
count: 1
path: ../../../src/network/mcpe/encryption/EncryptionUtils.php
-
message: "#^Parameter \\#2 \\$private_key of function openssl_pkey_derive expects array\\|OpenSSLAsymmetricKey\\|OpenSSLCertificate\\|string, resource given\\.$#"
count: 1
path: ../../../src/network/mcpe/encryption/EncryptionUtils.php
-
message: "#^Parameter \\#1 \\$key of function openssl_free_key expects OpenSSLAsymmetricKey, resource given\\.$#"
count: 1
path: ../../../src/network/mcpe/encryption/PrepareEncryptionTask.php
-
message: "#^Parameter \\#1 \\$key of function openssl_pkey_get_details expects OpenSSLAsymmetricKey, OpenSSLAsymmetricKey\\|resource given\\.$#"
count: 1
path: ../../../src/network/mcpe/encryption/PrepareEncryptionTask.php
-
message: "#^Parameter \\#1 \\$localPriv of static method pocketmine\\\\network\\\\mcpe\\\\encryption\\\\EncryptionUtils\\:\\:generateSharedSecret\\(\\) expects resource, OpenSSLAsymmetricKey given\\.$#"
count: 1
path: ../../../src/network/mcpe/encryption/PrepareEncryptionTask.php
-
message: "#^Parameter \\#1 \\$serverPriv of static method pocketmine\\\\network\\\\mcpe\\\\encryption\\\\EncryptionUtils\\:\\:generateServerHandshakeJwt\\(\\) expects resource, OpenSSLAsymmetricKey given\\.$#"
count: 1
path: ../../../src/network/mcpe/encryption/PrepareEncryptionTask.php
-
message: "#^Static property pocketmine\\\\network\\\\mcpe\\\\encryption\\\\PrepareEncryptionTask\\:\\:\\$SERVER_PRIVATE_KEY \\(resource\\|null\\) does not accept OpenSSLAsymmetricKey\\.$#"
count: 1
path: ../../../src/network/mcpe/encryption/PrepareEncryptionTask.php
-
message: "#^Parameter \\#1 \\$socket of function socket_bind expects Socket, resource given\\.$#"
count: 1
path: ../../../src/network/query/DedicatedQueryNetworkInterface.php
-
message: "#^Parameter \\#1 \\$socket of function socket_close expects Socket, resource given\\.$#"
count: 1
path: ../../../src/network/query/DedicatedQueryNetworkInterface.php
-
message: "#^Parameter \\#1 \\$socket of function socket_last_error expects Socket\\|null, resource given\\.$#"
count: 3
path: ../../../src/network/query/DedicatedQueryNetworkInterface.php
-
message: "#^Parameter \\#1 \\$socket of function socket_recvfrom expects Socket, resource given\\.$#"
count: 1
path: ../../../src/network/query/DedicatedQueryNetworkInterface.php
-
message: "#^Parameter \\#1 \\$socket of function socket_sendto expects Socket, resource given\\.$#"
count: 1
path: ../../../src/network/query/DedicatedQueryNetworkInterface.php
-
message: "#^Parameter \\#1 \\$socket of function socket_set_nonblock expects Socket, resource given\\.$#"
count: 1
path: ../../../src/network/query/DedicatedQueryNetworkInterface.php
-
message: "#^Property pocketmine\\\\network\\\\query\\\\DedicatedQueryNetworkInterface\\:\\:\\$socket \\(resource\\) does not accept Socket\\.$#"
count: 1
path: ../../../src/network/query/DedicatedQueryNetworkInterface.php
-
message: "#^Parameter \\#1 \\$ of closure expects resource, CurlHandle given\\.$#"
count: 1
path: ../../../src/utils/Internet.php
-
message: "#^Parameter \\#2 \\$offset of function substr expects int, mixed given\\.$#"
count: 1
path: ../../../src/utils/Internet.php
-
message: "#^Parameter \\#3 \\$length of function substr expects int\\|null, mixed given\\.$#"
count: 1
path: ../../../src/utils/Internet.php
-
message: "#^Parameter \\#1 \\$string of function trim expects string, string\\|false given\\.$#"
count: 1
path: ../../../src/utils/Timezone.php
-
message: "#^Parameter \\#1 \\$timezoneId of function date_default_timezone_set expects string, string\\|false given\\.$#"
count: 1
path: ../../../src/utils/Timezone.php
-
message: "#^Strict comparison using \\=\\=\\= between array\\<string, mixed\\> and false will always evaluate to false\\.$#"
count: 1
path: ../../../src/utils/Timezone.php
-
message: "#^Parameter \\#2 \\$array of function array_map expects array, mixed given\\.$#"
count: 1
path: ../../../src/utils/Utils.php
-
message: "#^Strict comparison using \\=\\=\\= between array and false will always evaluate to false\\.$#"
count: 1
path: ../../../src/utils/Utils.php