瀏覽代碼

TelegramBotHandler: skipping messages containing only whitespace (#1992)

#fixes https://github.com/Seldaek/monolog/issues/1991
Dawid Nowak 2 月之前
父節點
當前提交
28961f4174
共有 1 個文件被更改,包括 4 次插入0 次删除
  1. 4 0
      src/Monolog/Handler/TelegramBotHandler.php

+ 4 - 0
src/Monolog/Handler/TelegramBotHandler.php

@@ -233,6 +233,10 @@ class TelegramBotHandler extends AbstractProcessingHandler
 
 
     protected function sendCurl(string $message): void
     protected function sendCurl(string $message): void
     {
     {
+        if ('' === trim($message)) {
+            return;
+        }
+        
         $ch = curl_init();
         $ch = curl_init();
         $url = self::BOT_API . $this->apiKey . '/SendMessage';
         $url = self::BOT_API . $this->apiKey . '/SendMessage';
         curl_setopt($ch, CURLOPT_URL, $url);
         curl_setopt($ch, CURLOPT_URL, $url);