This commit is contained in:
parent
0489533c5f
commit
01853f7aac
|
|
@ -14,7 +14,7 @@ This is the changelog between releases of PHPWord. Releases are listed in revers
|
|||
|
||||
### Bugfixes
|
||||
|
||||
None yet.
|
||||
- Fix rare PclZip/realpath/PHP version problem - @andrew-kzoo GH-261
|
||||
|
||||
### Deprecated
|
||||
|
||||
|
|
@ -23,6 +23,8 @@ None yet.
|
|||
### Miscellaneous
|
||||
|
||||
- Docs: Add known issue on `README` about requirement for temporary folder to be writable and update `samples/index.php` for this requirement check - @ivanlanin GH-238
|
||||
- PclZip: Remove temporary file after used - @andrew-kzoo GH-265
|
||||
- Autoloader: Add the ability to set the autoloader options - @bskrtich GH-267
|
||||
|
||||
## 0.11.1 - 2 June 2014
|
||||
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@ class Autoloader
|
|||
/**
|
||||
* Register
|
||||
*
|
||||
* @param bool $throw
|
||||
* @param bool $prepend
|
||||
* @return void
|
||||
*/
|
||||
public static function register($throw = true, $prepend = false)
|
||||
|
|
|
|||
|
|
@ -218,18 +218,21 @@ class ZipArchive
|
|||
{
|
||||
/** @var \PclZip $zip Type hint */
|
||||
$zip = $this->zip;
|
||||
$test_filename = realpath($filename);
|
||||
if($test_filename !== false) {
|
||||
$filename = $test_filename;
|
||||
|
||||
// Bugfix GH-261 https://github.com/PHPOffice/PHPWord/pull/261
|
||||
$realpathFilename = realpath($filename);
|
||||
if ($realpathFilename !== false) {
|
||||
$filename = $realpathFilename;
|
||||
}
|
||||
|
||||
$filenameParts = pathinfo($filename);
|
||||
$localnameParts = pathinfo($localname);
|
||||
|
||||
// To Rename the file while adding it to the zip we
|
||||
// need to create a temp file with the correct name
|
||||
$temp_file = false;
|
||||
$tempFile = false;
|
||||
if ($filenameParts['basename'] != $localnameParts['basename']) {
|
||||
$temp_file = true; // temp file created
|
||||
$tempFile = true; // temp file created
|
||||
$temppath = $this->tempDir . '/' . $localnameParts['basename'];
|
||||
copy($filename, $temppath);
|
||||
$filename = $temppath;
|
||||
|
|
@ -241,7 +244,7 @@ class ZipArchive
|
|||
|
||||
$res = $zip->add($filename, PCLZIP_OPT_REMOVE_PATH, $pathRemoved, PCLZIP_OPT_ADD_PATH, $pathAdded);
|
||||
|
||||
if($temp_file) {
|
||||
if ($tempFile) {
|
||||
// Remove temp file, if created
|
||||
@unlink($this->tempDir . '/' . $localnameParts["basename"]);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue