mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-23 11:26:37 +00:00
ZippedResourcePack: ensure non-empty file
ZipArchive raises deprecation errors on empty files for some reason
This commit is contained in:
parent
4c9d2a989e
commit
52e3f1e269
@ -64,6 +64,13 @@ class ZippedResourcePack implements ResourcePack{
|
|||||||
if(!file_exists($zipPath)){
|
if(!file_exists($zipPath)){
|
||||||
throw new ResourcePackException("File not found");
|
throw new ResourcePackException("File not found");
|
||||||
}
|
}
|
||||||
|
$size = filesize($zipPath);
|
||||||
|
if($size === false){
|
||||||
|
throw new ResourcePackException("Unable to determine size of file");
|
||||||
|
}
|
||||||
|
if($size === 0){
|
||||||
|
throw new ResourcePackException("Empty file, probably corrupted");
|
||||||
|
}
|
||||||
|
|
||||||
$archive = new \ZipArchive();
|
$archive = new \ZipArchive();
|
||||||
if(($openResult = $archive->open($zipPath)) !== true){
|
if(($openResult = $archive->open($zipPath)) !== true){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user