Merge branch 'fix-rare-pclzip-temp-file-issue' of github.com:andrew-kzoo/PHPWord into develop
This commit is contained in:
commit
bc6b40dde5
|
|
@ -227,7 +227,9 @@ class ZipArchive
|
|||
|
||||
// To Rename the file while adding it to the zip we
|
||||
// need to create a temp file with the correct name
|
||||
$temp_file = false;
|
||||
if ($filenameParts['basename'] != $localnameParts['basename']) {
|
||||
$temp_file = true; // temp file created
|
||||
$temppath = $this->tempDir . '/' . $localnameParts['basename'];
|
||||
copy($filename, $temppath);
|
||||
$filename = $temppath;
|
||||
|
|
@ -239,6 +241,11 @@ class ZipArchive
|
|||
|
||||
$res = $zip->add($filename, PCLZIP_OPT_REMOVE_PATH, $pathRemoved, PCLZIP_OPT_ADD_PATH, $pathAdded);
|
||||
|
||||
if($temp_file) {
|
||||
// Remove temp file, if created
|
||||
@unlink($this->tempDir . '/' . $localnameParts["basename"]);
|
||||
}
|
||||
|
||||
return ($res == 0) ? false : true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue