Skip to content

Commit 01853f7

Browse files
committed
Update change log and adjust some coding standards for #261, #265, and #267
1 parent 0489533 commit 01853f7

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ This is the changelog between releases of PHPWord. Releases are listed in revers
1414

1515
### Bugfixes
1616

17-
None yet.
17+
- Fix rare PclZip/realpath/PHP version problem - @andrew-kzoo GH-261
1818

1919
### Deprecated
2020

@@ -23,6 +23,8 @@ None yet.
2323
### Miscellaneous
2424

2525
- 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
26+
- PclZip: Remove temporary file after used - @andrew-kzoo GH-265
27+
- Autoloader: Add the ability to set the autoloader options - @bskrtich GH-267
2628

2729
## 0.11.1 - 2 June 2014
2830

src/PhpWord/Autoloader.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ class Autoloader
2828
/**
2929
* Register
3030
*
31+
* @param bool $throw
32+
* @param bool $prepend
3133
* @return void
3234
*/
3335
public static function register($throw = true, $prepend = false)

src/PhpWord/Shared/ZipArchive.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -218,18 +218,21 @@ public function pclzipAddFile($filename, $localname = null)
218218
{
219219
/** @var \PclZip $zip Type hint */
220220
$zip = $this->zip;
221-
$test_filename = realpath($filename);
222-
if($test_filename !== false) {
223-
$filename = $test_filename;
221+
222+
// Bugfix GH-261 https://github.com/PHPOffice/PHPWord/pull/261
223+
$realpathFilename = realpath($filename);
224+
if ($realpathFilename !== false) {
225+
$filename = $realpathFilename;
224226
}
227+
225228
$filenameParts = pathinfo($filename);
226229
$localnameParts = pathinfo($localname);
227230

228231
// To Rename the file while adding it to the zip we
229232
// need to create a temp file with the correct name
230-
$temp_file = false;
233+
$tempFile = false;
231234
if ($filenameParts['basename'] != $localnameParts['basename']) {
232-
$temp_file = true; // temp file created
235+
$tempFile = true; // temp file created
233236
$temppath = $this->tempDir . '/' . $localnameParts['basename'];
234237
copy($filename, $temppath);
235238
$filename = $temppath;
@@ -241,7 +244,7 @@ public function pclzipAddFile($filename, $localname = null)
241244

242245
$res = $zip->add($filename, PCLZIP_OPT_REMOVE_PATH, $pathRemoved, PCLZIP_OPT_ADD_PATH, $pathAdded);
243246

244-
if($temp_file) {
247+
if ($tempFile) {
245248
// Remove temp file, if created
246249
@unlink($this->tempDir . '/' . $localnameParts["basename"]);
247250
}

0 commit comments

Comments
 (0)