Skip to content

Commit 988eaca

Browse files
Roman SyroeshkoRoman Syroeshko
authored andcommitted
Fix for #532.
1 parent 7a2125c commit 988eaca

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/PhpWord/TemplateProcessor.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,13 @@ public function saveAs($fileName)
339339
unlink($fileName);
340340
}
341341

342-
rename($tempFileName, $fileName);
342+
/*
343+
* Note: we do not use ``rename`` funcion here, because it looses file ownership data on Windows, and the file may not open.
344+
*
345+
* @see https://github.com/PHPOffice/PHPWord/issues/532
346+
*/
347+
copy($tempFileName, $fileName);
348+
unlink($tempFileName);
343349
}
344350

345351
/**

0 commit comments

Comments
 (0)