Skip to content

Commit 5e0fc7a

Browse files
committed
Fixed bug with new extension verification
1 parent d991fdc commit 5e0fc7a

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

Classes/PHPWord/Writer/Word2007.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,6 @@ public function save($pFilename = null)
199199
*/
200200
private function checkContentTypes($src)
201201
{
202-
$supportedImageTypes = array(IMAGETYPE_JPEG, IMAGETYPE_GIF, IMAGETYPE_PNG, IMAGETYPE_BMP, IMAGETYPE_TIFF_II, IMAGETYPE_TIFF_MM);
203-
204202
$extension = null;
205203
if (stripos(strrev($src), strrev('.php')) === 0) {
206204
$extension = 'php';
@@ -219,7 +217,7 @@ private function checkContentTypes($src)
219217
}
220218
}
221219

222-
if (in_array($extension, $supportedImageTypes)) {
220+
if (isset($extension)) {
223221
$imageData = getimagesize($src);
224222
$imageType = image_type_to_mime_type($imageData[2]);
225223
$imageExtension = str_replace('.', '', image_type_to_extension($imageData[2]));

Tests/_inc/TestHelperDOCX.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,12 @@ public static function deleteDir($dir)
5959

6060
rmdir($dir);
6161
}
62+
63+
/**
64+
* @return string
65+
*/
66+
public static function getFile()
67+
{
68+
return self::$file;
69+
}
6270
}

0 commit comments

Comments
 (0)