Skip to content

Fix UpdateHandler null exception when chat() is null#142

Merged
punyflash merged 1 commit intowestacks:4.xfrom
ahurov:4.x
Apr 18, 2026
Merged

Fix UpdateHandler null exception when chat() is null#142
punyflash merged 1 commit intowestacks:4.xfrom
ahurov:4.x

Conversation

@ahurov
Copy link
Copy Markdown
Contributor

@ahurov ahurov commented Apr 17, 2026

For pre_checkout_query and successful_payment updates, UpdateHandler throws a null reference exception when accessing is_forum:

Attempt to read property "is_forum" on null ... UpdateHandler.php:41

This happens because chat() returns ?Chat, and for these update types it may be null.

Attempt to read property "is_forum" on null {"exception":"[object] (ErrorException(code: 0): Attempt to read property "is_forum" on null at /var/www/html/vendor/westacks/telebot/src/Foundation/UpdateHandler.php:41)

The issue is that `chat()` returns `?Chat`, so it can be null.
@punyflash punyflash merged commit 1edc0b0 into westacks:4.x Apr 18, 2026
3 checks passed
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

Successfully merging this pull request may close these issues.

2 participants