From 988eaca87e7d820d6e69a28334f859aba005158b Mon Sep 17 00:00:00 2001 From: Roman Syroeshko Date: Thu, 2 Jul 2015 21:39:54 +0300 Subject: [PATCH] Fix for #532. --- src/PhpWord/TemplateProcessor.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/PhpWord/TemplateProcessor.php b/src/PhpWord/TemplateProcessor.php index 827ece0984..65819727dd 100644 --- a/src/PhpWord/TemplateProcessor.php +++ b/src/PhpWord/TemplateProcessor.php @@ -339,7 +339,13 @@ public function saveAs($fileName) unlink($fileName); } - rename($tempFileName, $fileName); + /* + * Note: we do not use ``rename`` funcion here, because it looses file ownership data on Windows, and the file may not open. + * + * @see https://github.com/PHPOffice/PHPWord/issues/532 + */ + copy($tempFileName, $fileName); + unlink($tempFileName); } /**