Procházet zdrojové kódy

Merge pull request #1438 from rickserrat/hotfix/gitprocessor

Check that  is not null before calling preg_match
Jordi Boggiano před 5 roky
rodič
revize
5c670ec3d2
1 změnil soubory, kde provedl 1 přidání a 1 odebrání
  1. 1 1
      src/Monolog/Processor/GitProcessor.php

+ 1 - 1
src/Monolog/Processor/GitProcessor.php

@@ -52,7 +52,7 @@ class GitProcessor implements ProcessorInterface
         }
         }
 
 
         $branches = `git branch -v --no-abbrev`;
         $branches = `git branch -v --no-abbrev`;
-        if (preg_match('{^\* (.+?)\s+([a-f0-9]{40})(?:\s|$)}m', $branches, $matches)) {
+        if ($branches && preg_match('{^\* (.+?)\s+([a-f0-9]{40})(?:\s|$)}m', $branches, $matches)) {
             return self::$cache = array(
             return self::$cache = array(
                 'branch' => $matches[1],
                 'branch' => $matches[1],
                 'commit' => $matches[2],
                 'commit' => $matches[2],