Skip to content

Commit d576060

Browse files
committed
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.
1 parent 38d3d7b commit d576060

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/PhpWord/Shared/ZipArchive.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,10 @@ public function pclzipAddFile($filename, $localname = null)
218218
{
219219
/** @var \PclZip $zip Type hint */
220220
$zip = $this->zip;
221-
$filename = realpath($filename);
221+
$test_filename = realpath($filename);
222+
if($test_filename !== false) {
223+
$filename = $test_filename;
224+
}
222225
$filenameParts = pathinfo($filename);
223226
$localnameParts = pathinfo($localname);
224227

0 commit comments

Comments
 (0)