We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7fdc50b commit 1cd4fbfCopy full SHA for 1cd4fbf
src/PhpWord/TemplateProcessor.php
@@ -356,13 +356,13 @@ protected function fixBrokenMacros($documentPart)
356
{
357
$fixedDocumentPart = $documentPart;
358
359
- $pattern = '|\$\{([^\}]+)\}|U';
360
- preg_match_all($pattern, $fixedDocumentPart, $matches);
361
- foreach ($matches[0] as $value) {
362
- $valueCleaned = preg_replace('/<[^>]+>/', '', $value);
363
- $valueCleaned = preg_replace('/<\/[^>]+>/', '', $valueCleaned);
364
- $fixedDocumentPart = str_replace($value, $valueCleaned, $fixedDocumentPart);
365
- }
+ $fixedDocumentPart = preg_replace_callback(
+ '|\$\{([^\}]+)\}|U',
+ function ($match) {
+ return strip_tags($match[0]);
+ },
+ $fixedDocumentPart
+ );
366
367
return $fixedDocumentPart;
368
}
0 commit comments