From d965a69601847c44acfe2d0648c3e0287cf190e9 Mon Sep 17 00:00:00 2001 From: "oe.sonnh" Date: Tue, 7 Jan 2020 11:44:37 +0700 Subject: [PATCH 1/2] Fix: CloneBlock regexp for different regexp engine with xml line-drop --- src/PhpWord/TemplateProcessor.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PhpWord/TemplateProcessor.php b/src/PhpWord/TemplateProcessor.php index 7efc0f1a..52470574 100644 --- a/src/PhpWord/TemplateProcessor.php +++ b/src/PhpWord/TemplateProcessor.php @@ -737,7 +737,7 @@ class TemplateProcessor $xmlBlock = null; $matches = array(); preg_match( - '/(<\?xml.*)(\${' . $blockname . '}<\/w:.*?p>)(.*)()/is', + '/(.*((?s)))(.*)((?s))/is', $this->tempDocumentMainPart, $matches ); From 608730531f8b02567dba17de0c6939f1849f66a7 Mon Sep 17 00:00:00 2001 From: "oe.sonnh" Date: Tue, 21 Jan 2020 16:42:19 +0700 Subject: [PATCH 2/2] Fix: Catastrophic Backtracking RegExp --- src/PhpWord/TemplateProcessor.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PhpWord/TemplateProcessor.php b/src/PhpWord/TemplateProcessor.php index 52470574..85a405c9 100644 --- a/src/PhpWord/TemplateProcessor.php +++ b/src/PhpWord/TemplateProcessor.php @@ -737,7 +737,7 @@ class TemplateProcessor $xmlBlock = null; $matches = array(); preg_match( - '/(.*((?s)))(.*)((?s))/is', + '/(.*((?s)))(.*)((?s))/is', $this->tempDocumentMainPart, $matches );