mirror of
https://github.com/retailcrm/PHPExcel.git
synced 2024-11-26 23:36:03 +03:00
Improved file identification by adding a magic signature test (0x1F,0x8B as the first two characters of the file)
git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@61956 2327b42d-5241-43d6-9e2a-de5ac946f064
This commit is contained in:
parent
45ac4eae14
commit
f04feb78f8
@ -196,6 +196,15 @@ class PHPExcel_Reader_Gnumeric implements PHPExcel_Reader_IReader
|
|||||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Read signature data (first 3 bytes)
|
||||||
|
$fh = fopen($pFilename, 'r');
|
||||||
|
$data = fread($fh, 2);
|
||||||
|
fclose($fh);
|
||||||
|
|
||||||
|
if ($data != chr(0x1F).chr(0x8B)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user