From 7c371e1d084f55a3a65649ed6ef98add19eaeda0 Mon Sep 17 00:00:00 2001 From: Roman Syroeshko Date: Sun, 16 Aug 2015 19:53:03 +0400 Subject: [PATCH] Merged #532. --- src/PhpWord/TemplateProcessor.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/PhpWord/TemplateProcessor.php b/src/PhpWord/TemplateProcessor.php index cbed973011..50bccb8544 100644 --- a/src/PhpWord/TemplateProcessor.php +++ b/src/PhpWord/TemplateProcessor.php @@ -335,7 +335,14 @@ public function saveAs($fileName) unlink($fileName); } - rename($tempFileName, $fileName); + /* + * Note: we do not use ``rename`` function here, because it looses file ownership data on Windows platform. + * As a result, user cannot open the file directly getting "Access denied" message. + * + * @see https://github.com/PHPOffice/PHPWord/issues/532 + */ + copy($tempFileName, $fileName); + unlink($tempFileName); } /**