pmmp / PocketMine-MP

A server software for Minecraft: Bedrock Edition in PHP
https://pmmp.io
GNU Lesser General Public License v3.0
3.27k stars 1.54k forks source link

Problem on PHP Version change #4330

Closed Crasher508 closed 3 years ago

Crasher508 commented 3 years ago

Issue description

On change from PHP 7.3 to PHP 7.4 it report me this error

Steps to reproduce the issue

  1. use Itemfactory::get()

OS and versions

Plugins

Crashdump, backtrace or other files

2021-07-23 16:58:45 Asynchronous Worker #0|CRITICAL > ErrorException: "Trying to access array offset on value of type null" (EXCEPTION) in "pmsrc/src/pocketmine/item/ItemFactory" at line 318 2021-07-23 16:58:45 Asynchronous Worker #0|CRITICAL > #0 pmsrc/src/pocketmine/item/ItemFactory(318): pocketmine\utils\Utils::errorExceptionHandler(integer 8, string[51] Trying to access array offset on value of type null, string[68] phar:///home/Farmwelt/PocketMine-MP.phar/src/pocketmine/item/ItemFactory.php, integer 318, array[4]) 2021-07-23 16:58:45 Asynchronous Worker #0|CRITICAL > #1 pmsrc/src/pocketmine/item/Item(872): pocketmine\item\ItemFactory::get(integer 320, integer 0, integer 64) 2021-07-23 16:58:45 Asynchronous Worker #0|CRITICAL > #2 plugins/BackPacks/src/PlayerVaults/Task/FetchInventoryTask(70): pocketmine\item\Item::nbtDeserialize(object pocketmine\nbt\tag\CompoundTag)

[66]$items = $nbt->getListTag("ItemList") ?? new ListTag("ItemList"); [67]$contents = []; [68]if(count($items) > 0){ [69] foreach($items->getValue() as $slot => $compoundTag){ [70] $contents[$compoundTag->getByte("Slot", $slot)] = Item::nbtDeserialize($compoundTag); [71] } [72]}

2021-07-23 16:58:45 Asynchronous Worker #0|CRITICAL > #3 pmsrc/src/pocketmine/scheduler/AsyncTask(85): PlayerVaults\Task\FetchInventoryTask->onRun() 2021-07-23 16:58:45 Asynchronous Worker #0|CRITICAL > #4 (): pocketmine\scheduler\AsyncTask->run() 2021-07-23 16:58:45 Server|CRITICAL > Could not execute asynchronous task FetchInventoryTask: Task crashed

dktapps commented 3 years ago

I think you're lost. This isn't Altay's issue tracker.

Crasher508 commented 3 years ago

This was a spam comment. Made with

V2h5IEFsdGF5Pw==

Disclaimer: This was not detected by a bot. This was detected by a magic from a no life no-life iron(II) thiooxide who watch the issue tracker all day very disrespectfully.

Crasher508 commented 3 years ago

Sorry my mistake, here is the Crash of PocketMine-MP 3.22.1

[19:06:29] [Asynchronous Worker #0 thread/CRITICAL]: ErrorException: "Trying to access array offset on value of type null" (EXCEPTION) in "pmsrc/src/pocketmine/item/ItemFactory" at line 318 [19:06:29] [Asynchronous Worker #0 thread/CRITICAL]: #0 pmsrc/src/pocketmine/item/ItemFactory(318): pocketmine\utils\Utils::errorExceptionHandler(integer 8, string[51] Trying to access array offset on value of type null, string[94] phar://D:/Dokumente/PHP/PMMP_Server/Git/PocketMine-MP.phar/src/pocketmine/item/I, integer 318, array[4]) [19:06:29] [Asynchronous Worker #0 thread/CRITICAL]: #1 pmsrc/src/pocketmine/item/Item(872): pocketmine\item\ItemFactory::get(integer 2, integer 0, integer 1) [19:06:29] [Asynchronous Worker #0 thread/CRITICAL]: #2 plugins/BackPacks/src/PlayerVaults/Task/FetchInventoryTask(70): pocketmine\item\Item::nbtDeserialize(object pocketmine\nbt\tag\CompoundTag) [19:06:29] [Asynchronous Worker #0 thread/CRITICAL]: #3 pmsrc/src/pocketmine/scheduler/AsyncTask(85): PlayerVaults\Task\FetchInventoryTask->onRun()

[19:06:29] [Server thread/CRITICAL]: Could not execute asynchronous task FetchInventoryTask: Task crashed

dktapps commented 3 years ago

This happens because ItemFactory::init() hasn't been called on the worker thread. This is a problem with your plugin.

Crasher508 commented 3 years ago

Oh okay, thank you very much