Vecnavium / FormsUI

A PocketMine-MP virion that allows you to create Forms.
GNU General Public License v3.0
15 stars 9 forks source link

FormValidation error "Expected an array response with the size 0, got 2" #4

Open Vecnavium opened 2 years ago

Vecnavium commented 2 years ago

Describe the bug A clear and concise description of what the bug is.

When you use CustomForm to create a UI and submit any data in a UI the FormValidation error would occur and send the output in console (it's down below) but would NOT crash the client.

To Reproduce Steps to reproduce the behavior:

  1. You may use StatsX or any plugin that uses CustomForm in PocketMine API 4.0.0.
  2. Join the server and open the UI, and submit the data in the UI then the output will be sent in console but would not crash the client.

Expected behavior A clear and concise description of what you expected to happen. FormsUI Library information FormsUI v1.1.0

Screenshots If applicable, add screenshots to help explain your problem.

Additional context Add any other context about the problem here.

This issue has been reported before there is no need to create another issue, we will find a solution to this problem.

Crashdump or other files related to the problem


2021-12-06 [07:38:41.678] [Server thread/CRITICAL]: pocketmine\form\FormValidationException: "Expected an array response with the size 0, got 2" (EXCEPTION) in "plugins/StatsX (1).phar/src/Vecnavium/StatsX/Forms/CustomForm" at line 30
--- Stack trace ---
  #0 plugins/StatsX (1).phar/src/Vecnavium/StatsX/Forms/Form(43): Vecnavium\StatsX\Forms\CustomForm->processData(array[2])
  #1 pmsrc/src/player/Player(1908): Vecnavium\StatsX\Forms\Form->handleResponse(object pocketmine\player\Player#25071, array[2])
  #2 pmsrc/src/network/mcpe/handler/InGamePacketHandler(774): pocketmine\player\Player->onFormSubmit(integer 0, array[2])
  #3 pmsrc/vendor/pocketmine/bedrock-protocol/src/ModalFormResponsePacket(55): pocketmine\network\mcpe\handler\InGamePacketHandler->handleModalFormResponse(object pocketmine\network\mcpe\protocol\ModalFormResponsePacket#88830)
  #4 pmsrc/src/network/mcpe/NetworkSession(395): pocketmine\network\mcpe\protocol\ModalFormResponsePacket->handle(object pocketmine\network\mcpe\handler\InGamePacketHandler#93410)
  #5 pmsrc/src/network/mcpe/NetworkSession(358): pocketmine\network\mcpe\NetworkSession->handleDataPacket(object pocketmine\network\mcpe\protocol\ModalFormResponsePacket#88830, string[22] e..[null,"Vecnavium"].)
  #6 pmsrc/src/network/mcpe/raklib/RakLibInterface(192): pocketmine\network\mcpe\NetworkSession->handleEncoded(string[25] .Ke...+...Q.KM.K,.,.U....)
  #7 pmsrc/vendor/pocketmine/raklib-ipc/src/RakLibToUserThreadMessageReceiver(42): pocketmine\network\mcpe\raklib\RakLibInterface->onPacketReceive(integer 0, string[34] .G..........= ,%&..Oj...f'.....}+m)
  #8 pmsrc/src/network/mcpe/raklib/RakLibInterface(122): raklib\server\ipc\RakLibToUserThreadMessageReceiver->handle(object pocketmine\network\mcpe\raklib\RakLibInterface#23437)
  #9 pmsrc/vendor/pocketmine/snooze/src/SleeperHandler(123): pocketmine\network\mcpe\raklib\RakLibInterface->pocketmine\network\mcpe\raklib\{closure}()
  #10 pmsrc/vendor/pocketmine/snooze/src/SleeperHandler(82): pocketmine\snooze\SleeperHandler->processNotifications()
  #11 pmsrc/src/Server(1645): pocketmine\snooze\SleeperHandler->sleepUntil(double 1638808721.6146)
  #12 pmsrc/src/Server(1034): pocketmine\Server->tickProcessor()
  #13 pmsrc/src/PocketMine(301): pocketmine\Server->__construct(object BaseClassLoader#2, object pocketmine\utils\MainLogger#3, string[46] A:\PocketMine-MP\PM4 (Testing plugins server)\, string[54] A:\PocketMine-MP\PM4 (Testing plugins server)\plugins\)
  #14 pmsrc/src/PocketMine(324): pocketmine\server()
  #15 pmsrc(11): require(string[90] phar://A:/PocketMine-MP/PM4 (Testing plugins server)/PocketMine-MP.phar/src/Pock)
--- End of exception information --- ```
Vecnavium commented 2 years ago

There is yet any official fix for this issue it's still a concurrent issue when FormValidation is implemented. To allow the users using FormsUI to actually be able to use the virion, FormValidation has been removed from the default branch and version v1.1.1 and FormValidation has been moved to https://github.com/Vecnavium/FormsUI/tree/formvalidation once the issue has officially been fixed FormValidation will be merged to the default branch and version

ShockedPlot7560 commented 2 years ago

This is probably due to the fact that in CustomForms, labels also return an element in the result, so with a label + 1 input, it will return an array of 2 and not 1 as currently expected.