Bugfix: (wolf5x) Work item 18492 - load file failed if the file has no extensionType

This commit is contained in:
Mark Baker 2012-08-19 23:57:16 +01:00
parent b00f6d4c4c
commit 83b8e9dad3
2 changed files with 10 additions and 7 deletions

View File

@ -223,6 +223,7 @@ class PHPExcel_IOFactory
// First, lucky guess by inspecting file extension // First, lucky guess by inspecting file extension
$pathinfo = pathinfo($pFilename); $pathinfo = pathinfo($pFilename);
$extensionType = NULL;
if (isset($pathinfo['extension'])) { if (isset($pathinfo['extension'])) {
switch (strtolower($pathinfo['extension'])) { switch (strtolower($pathinfo['extension'])) {
case 'xlsx': // Excel (OfficeOpenXML) Spreadsheet case 'xlsx': // Excel (OfficeOpenXML) Spreadsheet
@ -261,19 +262,20 @@ class PHPExcel_IOFactory
break; break;
} }
if ($extensionType !== NULL) {
$reader = self::createReader($extensionType); $reader = self::createReader($extensionType);
// Let's see if we are lucky // Let's see if we are lucky
if (isset($reader) && $reader->canRead($pFilename)) { if (isset($reader) && $reader->canRead($pFilename)) {
return $reader; return $reader;
} }
}
} }
// If we reach here then "lucky guess" didn't give any result // If we reach here then "lucky guess" didn't give any result
// Try walking through all the options in self::$_autoResolveClasses // Try walking through all the options in self::$_autoResolveClasses
foreach (self::$_autoResolveClasses as $autoResolveClass) { foreach (self::$_autoResolveClasses as $autoResolveClass) {
// Ignore our original guess, we know that won't work // Ignore our original guess, we know that won't work
if ($reader !== $extensionType) { if ($autoResolveClass !== $extensionType) {
$reader = self::createReader($autoResolveClass); $reader = self::createReader($autoResolveClass);
if ($reader->canRead($pFilename)) { if ($reader->canRead($pFilename)) {
return $reader; return $reader;

View File

@ -105,6 +105,7 @@ Fixed in develop branch:
- Bugfix: (MBaker) Work item 18146 - Chart Refresh returning cell reference rather than values - Bugfix: (MBaker) Work item 18146 - Chart Refresh returning cell reference rather than values
- Bugfix: (MBaker) Work item 18145 - Autoshape being identified in twoCellAnchor when includeCharts is TRUE triggering load error - Bugfix: (MBaker) Work item 18145 - Autoshape being identified in twoCellAnchor when includeCharts is TRUE triggering load error
- Bugfix: (MBaker) Work item 18325 - v-type texts for series labels now recognised and parsed correctly - Bugfix: (MBaker) Work item 18325 - v-type texts for series labels now recognised and parsed correctly
- Bugfix: (wolf5x) Work item 18492 - load file failed if the file has no extensionType
2012-05-19 (v1.7.7): 2012-05-19 (v1.7.7):