From: Tim Düsterhus Date: Sat, 25 Aug 2012 15:38:01 +0000 (+0200) Subject: Optimizing FileUtil X-Git-Tag: 2.0.0_Beta_1~954 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=56624595013343aaa5ac3eb9a9c2707564bdfd0e;p=GitHub%2FWoltLab%2FWCF.git Optimizing FileUtil --- diff --git a/wcfsetup/install/files/lib/util/FileUtil.class.php b/wcfsetup/install/files/lib/util/FileUtil.class.php index c0753930ee..407938f135 100644 --- a/wcfsetup/install/files/lib/util/FileUtil.class.php +++ b/wcfsetup/install/files/lib/util/FileUtil.class.php @@ -568,6 +568,9 @@ final class FileUtil { } } catch (SystemException $e) { + // clean up + if (isset($tmpname) && file_exists($tmpname)) @unlink($tmpname); + throw $e; } } @@ -594,7 +597,7 @@ final class FileUtil { // get bytes $block = $file->read($blockSize); - return (strlen($block) == 0 || preg_match_all('/\x00/', $block, $match) > 0); + return (strlen($block) == 0 || strpos($block, "\0") !== false); } /**