Skip to content

Commit 00d9509

Browse files
authored
Update TemplateProcessor.php
this fix replaceBlock
1 parent 1876062 commit 00d9509

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/PhpWord/TemplateProcessor.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -356,14 +356,14 @@ public function cloneBlock($blockname, $clones = 1, $replace = true)
356356
public function replaceBlock($blockname, $replacement)
357357
{
358358
preg_match(
359-
'/(<\?xml.*)(<w:p.*>\${' . $blockname . '}<\/w:.*?p>)(.*)(<w:p.*\${\/' . $blockname . '}<\/w:.*?p>)/is',
359+
'/\$\{' . $blockname . '}.*\$\{\/' . $blockname . '}/is',
360360
$this->tempDocumentMainPart,
361361
$matches
362362
);
363363

364-
if (isset($matches[3])) {
364+
if (isset($matches[0])) {
365365
$this->tempDocumentMainPart = str_replace(
366-
$matches[2] . $matches[3] . $matches[4],
366+
$matches[0],
367367
$replacement,
368368
$this->tempDocumentMainPart
369369
);

0 commit comments

Comments
 (0)