irazasyed / telegram-bot-sdk

🤖 Telegram Bot API PHP SDK. Lets you build Telegram Bots easily! Supports Laravel out of the box.
https://telegram-bot-sdk.com
BSD 3-Clause "New" or "Revised" License
3.04k stars 671 forks source link

setWebhook() and deleteWebhook() call returns undefined index for result array #1091

Closed jinyi-rc closed 8 months ago

jinyi-rc commented 1 year ago

PHP version

7.3.33 (7.3.33-12+ubuntu22.04.1+deb.sury.org+1)

irazasyed/telegram-bot-sdk version

v3.9

Laravel version (if any)

v6.20.44

Code To Reproduce the bug

$response = Telegram\Bot\Laravel\Facades\Telegram::setWebhook([
    'url' => $url,
]);

Error stacktrace (if any)

Undefined index: result

at vendor/irazasyed/telegram-bot-sdk/src/TelegramResponse.php:183
179|      */
180|     public function getResult()
181|     {
182|         return $this->decodedBody['result'];
183|     }
184| 
185|     /**
186|      * Throws the exception.

Exception trace:

1   Illuminate\Foundation\Bootstrap\HandleExceptions::handleError("Undefined index: result", "vendor/irazasyed/telegram-bot-sdk/src/TelegramResponse.php", [])
    vendor/irazasyed/telegram-bot-sdk/src/TelegramResponse.php:183

2   Telegram\Bot\TelegramResponse::getResult()
    vendor/irazasyed/telegram-bot-sdk/src/Methods/Update.php:115
irazasyed commented 8 months ago

Recheck if there are some issues connecting with Telegram servers. Also, use the latest version of the SDK.