From 6c73b04e458b3e8e11ef0b10347527f0d6235d6d Mon Sep 17 00:00:00 2001 From: Marko Kallio Date: Mon, 14 Aug 2017 07:52:49 +0300 Subject: [PATCH] Escaping regex pattern Asterisks in *Changelog* will cause errors while generating, should be escaped. --- src/Output/Writer.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Output/Writer.php b/src/Output/Writer.php index 952b99a..8fca32b 100644 --- a/src/Output/Writer.php +++ b/src/Output/Writer.php @@ -45,9 +45,11 @@ public function write() // Final log $log = join("\n", (array) $this->formatter->generate())."\n"; + $escaped = preg_quote($this->break); + // Include the breakpoint - if (false === empty($this->break) && 1 === preg_match("/^{$this->break}/m", $fileContent)) { - $splitFileContent = preg_split("/^{$this->break}/m", $fileContent); + if (false === empty($this->break) && 1 === preg_match("/^{$escaped}/m", $fileContent)) { + $splitFileContent = preg_split("/^{$escaped}/m", $fileContent); file_put_contents($this->formatter->getFileName(), $splitFileContent[0].$this->break."\n".$log.$splitFileContent[1]);