telegraph icon indicating copy to clipboard operation
telegraph copied to clipboard

Error in Keyboard::fromArray() method if InlineKeyboardButton button has empty query string

Open varemel opened this issue 1 year ago • 0 comments

Fix for my previous PR https://github.com/defstudio/telegraph/issues/533

Hi,

If I send message with 2 buttons:

  • InlineKeyboardButton with empty string query = ''
  • KeyboardButton

Than try to press KeyboardButton, Telegram send this CallbackQuery array to my webhook: Screenshot 2024-10-18 at 22 53 47

As you can see, switch_inline_query_current_chat=null instead of empty string. Telegram swap empty string with null value. It causes error DefStudio\Telegraph\Keyboard\Button::switchInlineQuery(): Argument #1 ($switchInlineQuery) must be of type string, null given, called in .../vendor/defstudio/telegraph/src/Keyboard/Keyboard.php on line 92

I made a PR. Is it OK to not add unit tests for this fix?

varemel avatar Oct 18 '24 20:10 varemel