ElectroGamesDev / BankUI

A BankUI Plugin For PocketMine
GNU General Public License v3.0
16 stars 14 forks source link

Server crashes when input a letter instead of a number (withdrawing and/or depositing money) #29

Closed TrinitroToluen0 closed 6 months ago

TrinitroToluen0 commented 7 months ago

To reproduce:

  1. Do /bank
  2. Click "Withdraw money" (or "Deposit money")
  3. Click "Withdraw custom" (or "Deposit custom")
  4. Type a letter and submit the form
  5. See the server crashing

Stack trace when withdrawing custom:

2024-04-03 [03:51:55.072] [Server thread/EMERGENCY]: Crash occurred while handling a packet from session: Player
2024-04-03 [03:51:55.073] [Server thread/CRITICAL]: TypeError: "ceil(): Argument #1 ($num) must be of type int|float, string given" (EXCEPTION) in "plugins/BankUI.phar/src/Electro/BankUI/BankUI" at line 518
--- Stack trace ---
  #0 plugins/BankUI.phar/src/Electro/BankUI/BankUI(518): ceil(string[1] q)
  #1 plugins/BankUI.phar/src/Electro/BankUI/libs/Vecnavium/FormsUI/Form(46): Electro\BankUI\BankUI->Electro\BankUI\{closure}(object pocketmine\player\Player#46330, array[2])
  #2 pmsrc/src/player/Player(2143): Electro\BankUI\libs\Vecnavium\FormsUI\Form->handleResponse(object pocketmine\player\Player#46330, array[2])
  #3 pmsrc/src/network/mcpe/handler/InGamePacketHandler(975): pocketmine\player\Player->onFormSubmit(int 2, array[2])
  #4 pmsrc/vendor/pocketmine/bedrock-protocol/src/ModalFormResponsePacket(63): pocketmine\network\mcpe\handler\InGamePacketHandler->handleModalFormResponse(object pocketmine\network\mcpe\protocol\ModalFormResponsePacket#191463)
  #5 pmsrc/src/network/mcpe/NetworkSession(456): pocketmine\network\mcpe\protocol\ModalFormResponsePacket->handle(object pocketmine\network\mcpe\handler\InGamePacketHandler#89098)
  #6 pmsrc/src/network/mcpe/NetworkSession(394): pocketmine\network\mcpe\NetworkSession->handleDataPacket(object pocketmine\network\mcpe\protocol\ModalFormResponsePacket#191463, string[16] e...[null,"q"]..)
  #7 pmsrc/src/network/mcpe/raklib/RakLibInterface(214): pocketmine\network\mcpe\NetworkSession->handleEncoded(string[18] ..e...[null,"q"]..)
  #8 pmsrc/vendor/pocketmine/raklib-ipc/src/RakLibToUserThreadMessageReceiver(40): pocketmine\network\mcpe\raklib\RakLibInterface->onPacketReceive(int 0, string[27] ...a.]..k........r.z..(7..1)
  #9 pmsrc/src/network/mcpe/raklib/RakLibInterface(107): raklib\server\ipc\RakLibToUserThreadMessageReceiver->handle(object pocketmine\network\mcpe\raklib\RakLibInterface#46112)
  #10 pmsrc/src/TimeTrackingSleeperHandler(58): pocketmine\network\mcpe\raklib\RakLibInterface->pocketmine\network\mcpe\raklib\{closure}()
  #11 pmsrc/vendor/pocketmine/snooze/src/SleeperHandler(120): pocketmine\TimeTrackingSleeperHandler->pocketmine\{closure}()
  #12 pmsrc/src/TimeTrackingSleeperHandler(77): pocketmine\snooze\SleeperHandler->processNotifications()
  #13 pmsrc/vendor/pocketmine/snooze/src/SleeperHandler(79): pocketmine\TimeTrackingSleeperHandler->processNotifications()
  #14 pmsrc/src/Server(1696): pocketmine\snooze\SleeperHandler->sleepUntil(float 1712116315.0868)
  #15 pmsrc/src/Server(1066): pocketmine\Server->tickProcessor()
  #16 pmsrc/src/PocketMine(350): pocketmine\Server->__construct(object pocketmine\thread\ThreadSafeClassLoader#6, object pocketmine\utils\MainLogger#3, string[18] /home/admin/Server/, string[26] /home/admin/Server/plugins/)
  #17 pmsrc/src/PocketMine(373): pocketmine\server()
  #18 pmsrc(11): require(string[62] phar:///home/admin/Server/PocketMine-MP.phar/src/PocketMine.php)
--- End of exception information ---

Stack trace when depositing custom:

2024-04-03 [03:52:34.081] [Server thread/EMERGENCY]: Crash occurred while handling a packet from session: Player
2024-04-03 [03:52:34.082] [Server thread/CRITICAL]: TypeError: "ceil(): Argument #1 ($num) must be of type int|float, string given" (EXCEPTION) in "plugins/BankUI.phar/src/Electro/BankUI/BankUI" at line 637
--- Stack trace ---
  #0 plugins/BankUI.phar/src/Electro/BankUI/BankUI(637): ceil(string[1] q)
  #1 plugins/BankUI.phar/src/Electro/BankUI/libs/Vecnavium/FormsUI/Form(46): Electro\BankUI\BankUI->Electro\BankUI\{closure}(object pocketmine\player\Player#48864, array[2])
  #2 pmsrc/src/player/Player(2143): Electro\BankUI\libs\Vecnavium\FormsUI\Form->handleResponse(object pocketmine\player\Player#48864, array[2])
  #3 pmsrc/src/network/mcpe/handler/InGamePacketHandler(975): pocketmine\player\Player->onFormSubmit(int 2, array[2])
  #4 pmsrc/vendor/pocketmine/bedrock-protocol/src/ModalFormResponsePacket(63): pocketmine\network\mcpe\handler\InGamePacketHandler->handleModalFormResponse(object pocketmine\network\mcpe\protocol\ModalFormResponsePacket#146737)
  #5 pmsrc/src/network/mcpe/NetworkSession(456): pocketmine\network\mcpe\protocol\ModalFormResponsePacket->handle(object pocketmine\network\mcpe\handler\InGamePacketHandler#88202)
  #6 pmsrc/src/network/mcpe/NetworkSession(394): pocketmine\network\mcpe\NetworkSession->handleDataPacket(object pocketmine\network\mcpe\protocol\ModalFormResponsePacket#146737, string[16] e...[null,"q"]..)
  #7 pmsrc/src/network/mcpe/raklib/RakLibInterface(214): pocketmine\network\mcpe\NetworkSession->handleEncoded(string[18] ..e...[null,"q"]..)
  #8 pmsrc/vendor/pocketmine/raklib-ipc/src/RakLibToUserThreadMessageReceiver(40): pocketmine\network\mcpe\raklib\RakLibInterface->onPacketReceive(int 0, string[27] ......F%.va....l..pTz!....?)
  #9 pmsrc/src/network/mcpe/raklib/RakLibInterface(107): raklib\server\ipc\RakLibToUserThreadMessageReceiver->handle(object pocketmine\network\mcpe\raklib\RakLibInterface#49103)
  #10 pmsrc/src/TimeTrackingSleeperHandler(58): pocketmine\network\mcpe\raklib\RakLibInterface->pocketmine\network\mcpe\raklib\{closure}()
  #11 pmsrc/vendor/pocketmine/snooze/src/SleeperHandler(120): pocketmine\TimeTrackingSleeperHandler->pocketmine\{closure}()
  #12 pmsrc/src/TimeTrackingSleeperHandler(77): pocketmine\snooze\SleeperHandler->processNotifications()
  #13 pmsrc/vendor/pocketmine/snooze/src/SleeperHandler(79): pocketmine\TimeTrackingSleeperHandler->processNotifications()
  #14 pmsrc/src/Server(1696): pocketmine\snooze\SleeperHandler->sleepUntil(float 1712116354.0979)
  #15 pmsrc/src/Server(1066): pocketmine\Server->tickProcessor()
  #16 pmsrc/src/PocketMine(350): pocketmine\Server->__construct(object pocketmine\thread\ThreadSafeClassLoader#6, object pocketmine\utils\MainLogger#3, string[18] /home/admin/Server/, string[26] /home/admin/Server/plugins/)
  #17 pmsrc/src/PocketMine(373): pocketmine\server()
  #18 pmsrc(11): require(string[62] phar:///home/admin/Server/PocketMine-MP.phar/src/PocketMine.php)
--- End of exception information ---