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
|
// To Rename the file while adding it to the zip we
|
||||||
// need to create a temp file with the correct name
|
// need to create a temp file with the correct name
|
||||||
|
$temp_file = false;
|
||||||
if ($filenameParts['basename'] != $localnameParts['basename']) {
|
if ($filenameParts['basename'] != $localnameParts['basename']) {
|
||||||
|
$temp_file = true; // temp file created
|
||||||
$temppath = $this->tempDir . '/' . $localnameParts['basename'];
|
$temppath = $this->tempDir . '/' . $localnameParts['basename'];
|
||||||
copy($filename, $temppath);
|
copy($filename, $temppath);
|
||||||
$filename = $temppath;
|
$filename = $temppath;
|
||||||
@ -239,6 +241,11 @@ class ZipArchive
|
|||||||
|
|
||||||
$res = $zip->add($filename, PCLZIP_OPT_REMOVE_PATH, $pathRemoved, PCLZIP_OPT_ADD_PATH, $pathAdded);
|
$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;
|
return ($res == 0) ? false : true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user