Update change log and adjust some coding standards for #261, #265, and #267

This commit is contained in:
Ivan Lanin 2014-06-07 17:48:45 +07:00
parent 0489533c5f
commit 01853f7aac
3 changed files with 14 additions and 7 deletions

View File

@ -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

View File

@ -28,6 +28,8 @@ class Autoloader
/**
* Register
*
* @param bool $throw
* @param bool $prepend
* @return void
*/
public static function register($throw = true, $prepend = false)

View File

@ -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"]);
}