core icon indicating copy to clipboard operation
core copied to clipboard

DB insertion errors

Open Alexell opened this issue 1 year ago • 1 comments

🐞 Bug Report

Required Information

? !
Operating system Ubuntu 24.04 LTS
PHP Telegram Bot version 0.83.1
PHP version 8.3.6
MySQL version 8.0.39
Update Method Webhook
Self-signed certificate no

Summary

So far it's just a question. I've been using the library for over a year and everything has always worked fine. However, recently errors have started appearing in the logs that weren't there before. Here are some examples of errors:

[09-Aug-2024 23:56:39] PHP Fatal error:  Uncaught TypeError: Longman\TelegramBot\DB::insertChat(): Argument #1 ($chat) must be of type Longman\TelegramBot\Entities\Chat, null given, called in /var/www/bot.local/vendor/longman/telegram-bot/src/DB.php on line 1296 and defined in /var/www/bot.local/vendor/longman/telegram-bot/src/DB.php:492
Stack trace:
#0 /var/www/bot.local/vendor/longman/telegram-bot/src/DB.php(1296): Longman\TelegramBot\DB::insertChat()
#1 /var/www/bot.local/vendor/longman/telegram-bot/src/DB.php(579): Longman\TelegramBot\DB::insertMessageRequest()
#2 /var/www/bot.local/vendor/longman/telegram-bot/src/Telegram.php(655): Longman\TelegramBot\DB::insertRequest()
#3 /var/www/bot.local/vendor/longman/telegram-bot/src/Telegram.php(568): Longman\TelegramBot\Telegram->processUpdate()
#4 /var/www/bot.local/hook-ghzfp4y52g5b7d5.php(72): Longman\TelegramBot\Telegram->handle()
#5 {main}
  thrown in /var/www/bot.local/vendor/longman/telegram-bot/src/DB.php on line 492

and

[16-Aug-2024 22:37:50] PHP Fatal error:  Uncaught TypeError: Longman\TelegramBot\DB::insertEditedMessageRequest(): Argument #1 ($edited_message) must be of type Longman\TelegramBot\Entities\Message, Longman\TelegramBot\Entities\Message\InaccessibleMessage given, called in /var/www/bot.local/vendor/longman/telegram-bot/src/DB.php on line 862 and defined in /var/www/bot.local/vendor/longman/telegram-bot/src/DB.php:1471
Stack trace:
#0 /var/www/bot.local/vendor/longman/telegram-bot/src/DB.php(862): Longman\TelegramBot\DB::insertEditedMessageRequest()
#1 /var/www/bot.local/vendor/longman/telegram-bot/src/DB.php(603): Longman\TelegramBot\DB::insertCallbackQueryRequest()
#2 /var/www/bot.local/vendor/longman/telegram-bot/src/Telegram.php(655): Longman\TelegramBot\DB::insertRequest()
#3 /var/www/bot.local/vendor/longman/telegram-bot/src/Telegram.php(568): Longman\TelegramBot\Telegram->processUpdate()
#4 /var/www/bot.local/hook-ghzfp4y52g5b7d5.php(72): Longman\TelegramBot\Telegram->handle()
#5 {main}
  thrown in /var/www/bot.local/vendor/longman/telegram-bot/src/DB.php on line 1471

If I perform actions in the bot from several accounts, then there are no problems. Probably, this occurs with other users, so I do not know how to recreate this problem. But I would like to understand why it occurs.

Additionally: earlier, almost a year ago, I had php-telegram-bot 0.80.0 and it worked on Ubuntu 22.04 + PHP 8.1 and I have never seen such errors in the logs.

Alexell avatar Aug 18 '24 06:08 Alexell

This needs to be fixed. This is a piece of the message request body to reproduce the issue: { "forward_origin": { "date": 1734445235, "sender_chat": { "id": -xxxx, "title": "yyyy", "type": "supergroup" }, "type": "chat" } }

VoDmAl avatar Jan 09 '25 00:01 VoDmAl