Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid argument supplied for foreach(), forwardMessage() in Telegram.php #42

Open
sinasadeghi83 opened this issue Jun 15, 2021 · 0 comments

Comments

@sinasadeghi83
Copy link

Hello
I tried to use forward function and it's working but also throws 500 Internal Server Error.

My code:
public function actionGuide($message) { $response = Yii::$app->telegram->forwardMessage([ 'chat_id' => $message->chat['id'], 'from_chat_id' => '@sinaapps', 'message_id' => 'fa' == Yii::$app->language ? 34 : 33, ]); }

Error stack trace:
{ "name": "PHP Warning", "message": "Invalid argument supplied for foreach()", "code": 2, "type": "yii\\base\\ErrorException", "file": "E:\\xampp\\htdocs\\myproject\\vendor\\yiisoft\\yii2\\BaseYii.php", "line": 557, "stack-trace": [ "#0 E:\\xampp\\htdocs\\myproject\\vendor\\yiisoft\\yii2\\BaseYii.php(557): yii\\web\\ErrorHandler->handleError()", "#1 E:\\xampp\\htdocs\\myproject\\vendor\\yiisoft\\yii2\\base\\BaseObject.php(107): yii\\BaseYii::configure()", "#2 E:\\xampp\\htdocs\\myproject\\vendor\\aki\\yii2-bot-telegram\\base\\Response.php(41): aki\\telegram\\base\\Input->__construct()", "#3 E:\\xampp\\htdocs\\myproject\\vendor\\yiisoft\\yii2\\base\\Component.php(180): aki\\telegram\\base\\Response->setResult()", "#4 E:\\xampp\\htdocs\\myproject\\vendor\\yiisoft\\yii2\\BaseYii.php(558): aki\\telegram\\base\\Response->__set()", "#5 E:\\xampp\\htdocs\\myproject\\vendor\\yiisoft\\yii2\\base\\BaseObject.php(107): yii\\BaseYii::configure()", "#6 E:\\xampp\\htdocs\\myproject\\vendor\\aki\\yii2-bot-telegram\\Telegram.php(88): aki\\telegram\\base\\Response->__construct()", "#7 E:\\xampp\\htdocs\\myproject\\controllers\\MainController.php(109): aki\\telegram\\Telegram->forwardMessage()", "#8 E:\\xampp\\htdocs\\myproject\\vendor\\yiisoft\\yii2\\base\\InlineAction.php(57): app\\controllers\\MainController->actionGuide()", "#9 E:\\xampp\\htdocs\\myproject\\vendor\\yiisoft\\yii2\\base\\InlineAction.php(57): ::call_user_func_array:{E:\\xampp\\htdocs\\myproject\\vendor\\yiisoft\\yii2\\base\\InlineAction.php:57}()", "#10 E:\\xampp\\htdocs\\myproject\\vendor\\yiisoft\\yii2\\base\\Controller.php(180): yii\\base\\InlineAction->runWithParams()", "#11 E:\\xampp\\htdocs\\myproject\\vendor\\yiisoft\\yii2\\base\\Module.php(528): app\\controllers\\MainController->runAction()", "#12 E:\\xampp\\htdocs\\myproject\\controllers\\TelegramController.php(149): yii\\web\\Application->runAction()", "#13 E:\\xampp\\htdocs\\myproject\\controllers\\TelegramController.php(93): app\\controllers\\TelegramController->runCommand()", "#14 E:\\xampp\\htdocs\\myproject\\vendor\\yiisoft\\yii2\\base\\InlineAction.php(57): app\\controllers\\TelegramController->actionIndex()", "#15 E:\\xampp\\htdocs\\myproject\\vendor\\yiisoft\\yii2\\base\\InlineAction.php(57): ::call_user_func_array:{E:\\xampp\\htdocs\\myproject\\vendor\\yiisoft\\yii2\\base\\InlineAction.php:57}()", "#16 E:\\xampp\\htdocs\\myproject\\vendor\\yiisoft\\yii2\\base\\Controller.php(180): yii\\base\\InlineAction->runWithParams()", "#17 E:\\xampp\\htdocs\\myproject\\vendor\\yiisoft\\yii2\\base\\Module.php(528): app\\controllers\\TelegramController->runAction()", "#18 E:\\xampp\\htdocs\\myproject\\vendor\\yiisoft\\yii2\\web\\Application.php(103): yii\\web\\Application->runAction()", "#19 E:\\xampp\\htdocs\\myproject\\vendor\\yiisoft\\yii2\\base\\Application.php(386): yii\\web\\Application->handleRequest()", "#20 E:\\xampp\\htdocs\\myproject\\web\\index.php(12): yii\\web\\Application->run()", "#21 {main}" ] }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant