chesslablab/chess-server

PHP Fatal error: Uncaught TypeError: Chess\Piece\K::fen()

d47081 opened this issue ยท 1 comments

d47081 commented

PHP 8.2

After some time of server running on game session:

PHP Fatal error:  Uncaught TypeError: Chess\Piece\K::fen(): Return value must be of type string, none returned in /home/chess/chess-server/vendor/chesslablab/php-chess/src/Piece/K.php:203
Stack trace:
#0 /home/chess/chess-server/vendor/chesslablab/php-chess/src/Variant/Classical/Board.php(1111): Chess\Piece\K->fen()
#1 /home/chess/chess-server/src/Game/AbstractMode.php(76): Chess\Variant\Classical\Board->legal()
#2 /home/chess/chess-server/src/Command/LegalCommand.php(34): ChessServer\Game\AbstractMode->res()
#3 /home/chess/chess-server/src/Socket/WebSocket.php(41): ChessServer\Command\LegalCommand->run()
#4 /home/chess/chess-server/vendor/cboden/ratchet/src/Ratchet/WebSocket/WsServer.php(75): ChessServer\Socket\WebSocket->onMessage()
#5 /home/chess/chess-server/vendor/cboden/ratchet/src/Ratchet/WebSocket/WsServer.php(131): Ratchet\WebSocket\WsServer->Ratchet\WebSocket\{closure}()
#6 /home/chess/chess-server/vendor/ratchet/rfc6455/src/Messaging/MessageBuffer.php(248): Ratchet\WebSocket\WsServer->Ratchet\WebSocket\{closure}()
#7 /home/chess/chess-server/vendor/ratchet/rfc6455/src/Messaging/MessageBuffer.php(194): Ratchet\RFC6455\Messaging\MessageBuffer->processData()
#8 /home/chess/chess-server/vendor/cboden/ratchet/src/Ratchet/WebSocket/WsServer.php(153): Ratchet\RFC6455\Messaging\MessageBuffer->onData()
#9 /home/chess/chess-server/vendor/cboden/ratchet/src/Ratchet/Http/HttpServer.php(54): Ratchet\WebSocket\WsServer->onMessage()
#10 /home/chess/chess-server/vendor/cboden/ratchet/src/Ratchet/Server/IoServer.php(112): Ratchet\Http\HttpServer->onMessage()
#11 /home/chess/chess-server/vendor/cboden/ratchet/src/Ratchet/Server/IoServer.php(95): Ratchet\Server\IoServer->handleData()
#12 /home/chess/chess-server/vendor/evenement/evenement/src/EventEmitterTrait.php(143): Ratchet\Server\IoServer->Ratchet\Server\{closure}()
#13 /home/chess/chess-server/vendor/react/stream/src/Util.php(71): Evenement\EventEmitter->emit()
#14 /home/chess/chess-server/vendor/evenement/evenement/src/EventEmitterTrait.php(143): React\Stream\Util::React\Stream\{closure}()
#15 /home/chess/chess-server/vendor/react/stream/src/DuplexResourceStream.php(196): Evenement\EventEmitter->emit()
#16 /home/chess/chess-server/vendor/react/event-loop/src/StreamSelectLoop.php(246): React\Stream\DuplexResourceStream->handleData()
#17 /home/chess/chess-server/vendor/react/event-loop/src/StreamSelectLoop.php(213): React\EventLoop\StreamSelectLoop->waitForStreamActivity()
#18 /home/chess/chess-server/vendor/cboden/ratchet/src/Ratchet/Server/IoServer.php(74): React\EventLoop\StreamSelectLoop->run()
#19 /home/chess/chess-server/cli/dev.php(26): Ratchet\Server\IoServer->run()
#20 {main}
  thrown in /home/chess/chess-server/vendor/chesslablab/php-chess/src/Piece/K.php on line 203

p.s. sorry this issue related to the repo https://github.com/chesslablab/php-chess

d47081 commented

Fixed data type and default value in following PR:
chesslablab/php-chess#442

Just please check for why nothing could be triggered there - if that's possible by the internal app logic - let's close the issue.