A common handler for more than one packet comes in handy for packets with similar properties, such as changing the metadata for SetActorDataPacket and AddActorPacket.
Steps to reproduce
Install muqsit/simple-packet-handler:dev-pm5
Register an outgoing packet interceptor with a closure in which its first argument has more than one packet type in union. (Sample code below.)
Run the code.
Expected result: the handler is called when the server sends both packets.
Actual result: server crashed on startup. (Crashdump below.)
Description
PHP 8.0 union type not supported.
A common handler for more than one packet comes in handy for packets with similar properties, such as changing the metadata for SetActorDataPacket and AddActorPacket.
Steps to reproduce
Expected result: the handler is called when the server sends both packets. Actual result: server crashed on startup. (Crashdump below.)
Sample code
Crashdump
https://crash.pmmp.io/view/11713385?access_token=c5f7e6eee1d988b5
Please notice that the original stack trace was generated by Await-Generator. Parts of the content are unneeded.
Environment
PHP: 8.2.17 PocketMine-MP: 5.19.0 SimplePacketHandler: 8121eca3f21cb9912c3ac8406a11f70cf105c905