Muqsit / InvMenu

A PocketMine-MP virion to create and manage virtual inventories!
https://poggit.pmmp.io/ci/Muqsit/InvMenu/~
GNU General Public License v3.0
201 stars 75 forks source link

Class Ds\Queue not found. #147

Closed AIPTU closed 3 years ago

AIPTU commented 3 years ago

When a player joins the server this happens Crash: https://crash.pmmp.io/view/5007136 My repository that use InvMenu: PiggyMinions

AIPTU commented 3 years ago

does this error apply to all plugins that use InvMenu before version 4.1.1 ?

Muqsit commented 3 years ago

Somewhat. It's more about how outdated the users' php binaries are (support for php-ds for stable versions was dropped a week back: https://github.com/pmmp/php-build-scripts/commit/855d00960ebe53fa5c0f71d6cd9b6588c51731cc).

But yeah, using InvMenu v4.1.1 for PM3 plugins should solve the issue. The fix is compatible with the new and older php binaries.

SOF3 commented 3 years ago

What is the latest status of this? Is it true that php-ds is no longer supported in PHP 8, and what are the official suggestions for users?

Muqsit commented 3 years ago

It was dropped by pmmp's php-build-scripts a few months before pmmp started to ship PHP 8 builds, but it was dropped more so due to it being unmaintained and highly prone to segfaults (see https://github.com/php-ds/ext-ds/issues/159 f.e) than having to upgrade it to PHP8.

Pmmp started to use pmmp/PocketMine-MP > pocketmine\utils\ObjectSet in place of Ds\Set after dropping support for it (https://github.com/pmmp/PocketMine-MP/commit/c61f66d973ba4827e6a0a5df462716329de5267d, pmmp used ext-ds's sets only to store objects so only an ObjectSet based on array<spl_object_id(object), true> was required and no native type sets).

There are no official suggestions but php-ds ships a polyfill composer library which seems to be equivalent of the php-ds/ext-ds C extension but in pure PHP. Given the instability of the extension as it causes segfaults at random, anything other than the C extension would serve as a better alternative. PHP's (SPL)[https://www.php.net/manual/en/book.spl.php] has some data structures, but for something like a StringSet, I suppose devs would need to shift to the usual array<string, any> pattern (StringSet::contains(string) => isset(array[string])).

SOF3 commented 3 years ago

I meant official suggestions for InvMenu. I didn't notice you already stopped using it 🙃

Muqsit commented 3 years ago

Ahh.. users can set version in .poggit.yml to ^4.1.1 if using api 3, or ^4.0.1 if on api 4

SOF3 commented 3 years ago

Ahh.. users can set version in .poggit.yml to ^4.1.1 if using api 3, or ^4.0.1 if on api 4

Are you sure you didn't make a typo there?

Muqsit commented 3 years ago

php-build-scripts targeting pmmp api 4 ditched ext-ds several months prior to php-build-scripts targeting pmmp api 3, hence the disconnect... i intended to ditch ext-ds usages from invmenu targeting api 3 at the same time as when php-build-scripts for pmmp api 4 ditched it, but I completely forgot and only realized it once the class-not-found bug reports started coming.

SOF3 commented 3 years ago

But the semver ^4.0.1 is a superset of ^4.1.1, and will auto update to those.

Muqsit commented 3 years ago

Version numbers are a little off between pmmp api 3 and pmmp api 4 InvMenu branches InvMenu v4.1.1 (branch: master) which targets pmmp api 3 and InvMenu v4.0.1 (branch: 4.0) which targets pmmp api 4 have ext-ds removed