diff --git a/src/PhpWord/TemplateProcessor.php b/src/PhpWord/TemplateProcessor.php index a591ad5a..582c3509 100644 --- a/src/PhpWord/TemplateProcessor.php +++ b/src/PhpWord/TemplateProcessor.php @@ -18,14 +18,14 @@ namespace PhpOffice\PhpWord; -use PhpOffice\PhpWord\Shared\ZipArchive; -use PhpOffice\PhpWord\Shared\XMLWriter; -use PhpOffice\PhpWord\Shared\Text; -use PhpOffice\PhpWord\Exception\Exception; -use PhpOffice\PhpWord\Exception\CreateTemporaryFileException; -use PhpOffice\PhpWord\Exception\CopyFileException; -use PhpOffice\PhpWord\Escaper\Xml; use PhpOffice\PhpWord\Escaper\RegExp; +use PhpOffice\PhpWord\Escaper\Xml; +use PhpOffice\PhpWord\Exception\CopyFileException; +use PhpOffice\PhpWord\Exception\CreateTemporaryFileException; +use PhpOffice\PhpWord\Exception\Exception; +use PhpOffice\PhpWord\Shared\Text; +use PhpOffice\PhpWord\Shared\XMLWriter; +use PhpOffice\PhpWord\Shared\ZipArchive; class TemplateProcessor { @@ -662,7 +662,7 @@ class TemplateProcessor if (preg_match('/(<[^<]+>)([^<]*)(' . preg_quote($varNameWithArgsFixed) . ')([^>]*)(<[^>]+>)/Uu', $partContent, $matches)) { $wholeTag = $matches[0]; array_shift($matches); - list($openTag, $prefix,, $postfix, $closeTag) = $matches; + list($openTag, $prefix, , $postfix, $closeTag) = $matches; $replaceXml = $openTag . $prefix . $closeTag . $xmlImage . $openTag . $postfix . $closeTag; // replace on each iteration, because in one tag we can have 2+ inline variables => before proceed next variable we need to change $partContent $partContent = $this->setValueForPart($wholeTag, $replaceXml, $partContent, $limit); @@ -1074,6 +1074,7 @@ class TemplateProcessor while (strpos($this->tempDocumentRelations[$documentPartName], 'Id="rId' . $candidate . '"') !== false) { $candidate++; } + return $candidate; }