Skip to content

Commit 6087305

Browse files
committed
Fix: Catastrophic Backtracking RegExp
1 parent d965a69 commit 6087305

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/PhpWord/TemplateProcessor.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,7 @@ public function cloneBlock($blockname, $clones = 1, $replace = true, $indexVaria
737737
$xmlBlock = null;
738738
$matches = array();
739739
preg_match(
740-
'/(.*((?s)<w:p\b(?:(?!<w:p\b).)*?\${' . $blockname . '}<\/w:.*?p>))(.*)((?s)<w:p\b(?:(?!<w:p\b).)*?\${\/' . $blockname . '}<\/w:.*?p>)/is',
740+
'/(.*((?s)<w:p\b(?:(?!<w:p\b).)*?\${' . $blockname . '}<\/w:.*?p>))(.*)((?s)<w:p\b(?:(?!<w:p\b).)[^$]*?\${\/' . $blockname . '}<\/w:.*?p>)/is',
741741
$this->tempDocumentMainPart,
742742
$matches
743743
);

0 commit comments

Comments
 (0)