Skip to content

Commit a4b5320

Browse files
authored
Merge pull request #1162 from abcdmitry/patch-2
Break the references in foreach within TemplateProcessor
2 parents 7790b6a + 7792eb2 commit a4b5320

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/PhpWord/TemplateProcessor.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ protected function transformXml($xml, $xsltProcessor)
174174
foreach ($xml as &$item) {
175175
$item = $this->transformSingleXml($item, $xsltProcessor);
176176
}
177+
unset($item);
177178
} else {
178179
$xml = $this->transformSingleXml($xml, $xsltProcessor);
179180
}
@@ -246,6 +247,7 @@ public function setValue($search, $replace, $limit = self::MAXIMUM_REPLACEMENTS_
246247
foreach ($search as &$item) {
247248
$item = static::ensureMacroCompleted($item);
248249
}
250+
unset($item);
249251
} else {
250252
$search = static::ensureMacroCompleted($search);
251253
}
@@ -254,6 +256,7 @@ public function setValue($search, $replace, $limit = self::MAXIMUM_REPLACEMENTS_
254256
foreach ($replace as &$item) {
255257
$item = static::ensureUtf8Encoded($item);
256258
}
259+
unset($item);
257260
} else {
258261
$replace = static::ensureUtf8Encoded($replace);
259262
}

0 commit comments

Comments
 (0)