From 56624595013343aaa5ac3eb9a9c2707564bdfd0e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Sat, 25 Aug 2012 17:38:01 +0200 Subject: [PATCH] Optimizing FileUtil --- wcfsetup/install/files/lib/util/FileUtil.class.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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); } /** -- 2.20.1