Skip to content

Commit 97f6fd1

Browse files
committed
Fix sendToActiveChats to correctly check if the callback action is valid.
fixes #897
1 parent b2ee9cd commit 97f6fd1

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Exclamation symbols (:exclamation:) note something of importance e.g. breaking c
1414
### Deprecated
1515
### Removed
1616
### Fixed
17+
- `sendToActiveChats` now works correctly for any valid Request action.
1718
### Security
1819

1920
## [0.54.0] - 2018-07-21

src/Request.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -605,17 +605,15 @@ public static function sendToActiveChats(
605605
array $data,
606606
array $select_chats_params
607607
) {
608-
if (!method_exists(Request::class, $callback_function)) {
609-
throw new TelegramException('Method "' . $callback_function . '" not found in class Request.');
610-
}
608+
self::ensureValidAction($callback_function);
611609

612610
$chats = DB::selectChats($select_chats_params);
613611

614612
$results = [];
615613
if (is_array($chats)) {
616614
foreach ($chats as $row) {
617615
$data['chat_id'] = $row['chat_id'];
618-
$results[] = call_user_func(Request::class . '::' . $callback_function, $data);
616+
$results[] = self::send($callback_function, $data);
619617
}
620618
}
621619

0 commit comments

Comments
 (0)