From d57606082db85f52a30ac924b1972c58579e1aec Mon Sep 17 00:00:00 2001 From: Andrew Collins Date: Wed, 4 Jun 2014 13:27:18 -0400 Subject: [PATCH] Fix rare PclZip/realpath/PHP version problem In PHP 5.4.4 realpath() handles absolute paths correctly, but in PHP 5.3.8 returns false. --- src/PhpWord/Shared/ZipArchive.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/PhpWord/Shared/ZipArchive.php b/src/PhpWord/Shared/ZipArchive.php index cbfcb07127..c5d56b01bb 100644 --- a/src/PhpWord/Shared/ZipArchive.php +++ b/src/PhpWord/Shared/ZipArchive.php @@ -218,7 +218,10 @@ public function pclzipAddFile($filename, $localname = null) { /** @var \PclZip $zip Type hint */ $zip = $this->zip; - $filename = realpath($filename); + $test_filename = realpath($filename); + if($test_filename !== false) { + $filename = $test_filename; + } $filenameParts = pathinfo($filename); $localnameParts = pathinfo($localname);