当使用PHP压缩类提取一个zip文件(其实这是不好的,但谁知道?),PHP拉链无限循环
$ unzip -t 1.zip
file #47: bad zipfile offset (local header sig): 574665
...
At least one error was detected in 1.zip.
<?php
function unzip($apkpath, $dirname) { //
$zip = new ZipArchive;
$res = $zip->open($apkpath);
if ($res === TRUE) {
$zip->extractTo($dirname);
$zip->close();
return true;
} else {
return false;
}
}
unzip('com.nd.sms.zip', '2'); // It's ok
//unzip('1.zip', '2'); //this line go into infinite loop and very heigh cpu
unzip('com.nd.sms.zip', '2');
?>
任何人都知道如何安全地使用ZipArchive,或其他附加信息替代,或者某种方式来检查压缩文件是否有效? 另外,我使用php5.3.14 + ubuntu。
我知道有, https://bugs.php.net/bug.php?id=53230 https://bugs.php.net/bug.php?id=57905
出于安全原因更新系统库。那你很好。请联系您的系统管理员,了解您拥有的选项。 – hakre 2012-07-21 09:54:32