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
|
### Bugfixes
|
||||||
|
|
||||||
None yet.
|
- Fix rare PclZip/realpath/PHP version problem - @andrew-kzoo GH-261
|
||||||
|
|
||||||
### Deprecated
|
### Deprecated
|
||||||
|
|
||||||
@ -23,6 +23,8 @@ None yet.
|
|||||||
### Miscellaneous
|
### 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
|
- 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
|
## 0.11.1 - 2 June 2014
|
||||||
|
|
||||||
|
|||||||
@ -28,6 +28,8 @@ class Autoloader
|
|||||||
/**
|
/**
|
||||||
* Register
|
* Register
|
||||||
*
|
*
|
||||||
|
* @param bool $throw
|
||||||
|
* @param bool $prepend
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public static function register($throw = true, $prepend = false)
|
public static function register($throw = true, $prepend = false)
|
||||||
|
|||||||
@ -218,18 +218,21 @@ class ZipArchive
|
|||||||
{
|
{
|
||||||
/** @var \PclZip $zip Type hint */
|
/** @var \PclZip $zip Type hint */
|
||||||
$zip = $this->zip;
|
$zip = $this->zip;
|
||||||
$test_filename = realpath($filename);
|
|
||||||
if($test_filename !== false) {
|
// Bugfix GH-261 https://github.com/PHPOffice/PHPWord/pull/261
|
||||||
$filename = $test_filename;
|
$realpathFilename = realpath($filename);
|
||||||
|
if ($realpathFilename !== false) {
|
||||||
|
$filename = $realpathFilename;
|
||||||
}
|
}
|
||||||
|
|
||||||
$filenameParts = pathinfo($filename);
|
$filenameParts = pathinfo($filename);
|
||||||
$localnameParts = pathinfo($localname);
|
$localnameParts = pathinfo($localname);
|
||||||
|
|
||||||
// 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;
|
$tempFile = false;
|
||||||
if ($filenameParts['basename'] != $localnameParts['basename']) {
|
if ($filenameParts['basename'] != $localnameParts['basename']) {
|
||||||
$temp_file = true; // temp file created
|
$tempFile = true; // temp file created
|
||||||
$temppath = $this->tempDir . '/' . $localnameParts['basename'];
|
$temppath = $this->tempDir . '/' . $localnameParts['basename'];
|
||||||
copy($filename, $temppath);
|
copy($filename, $temppath);
|
||||||
$filename = $temppath;
|
$filename = $temppath;
|
||||||
@ -241,7 +244,7 @@ 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) {
|
if ($tempFile) {
|
||||||
// Remove temp file, if created
|
// Remove temp file, if created
|
||||||
@unlink($this->tempDir . '/' . $localnameParts["basename"]);
|
@unlink($this->tempDir . '/' . $localnameParts["basename"]);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user