From 3f8f8027d25ab39283d0ab13afcf7252dde8f240 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Tue, 7 Jan 2014 13:50:57 +0100 Subject: [PATCH] Cast to numeric instead of float, i.e. use an integer if possible. --- lib/private/files/storage/local.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/private/files/storage/local.php b/lib/private/files/storage/local.php index fc2a590f6c..7fa748a7fd 100644 --- a/lib/private/files/storage/local.php +++ b/lib/private/files/storage/local.php @@ -224,7 +224,7 @@ if (\OC_Util::runningOnWindows()) { /** * @brief Tries to get the filesize via various workarounds if necessary. * @param string $fullPath - * @return mixed Number of bytes as float on success and workaround necessary, null otherwise. + * @return mixed Number of bytes on success and workaround necessary, null otherwise. */ private static function getFileSizeWithTricks($fullPath) { if (PHP_INT_SIZE === 4) { @@ -249,7 +249,7 @@ if (\OC_Util::runningOnWindows()) { /** * @brief Tries to get the filesize via a CURL HEAD request. * @param string $fullPath - * @return mixed Number of bytes as float on success, null otherwise. + * @return mixed Number of bytes on success, null otherwise. */ private static function getFileSizeFromCurl($fullPath) { if (function_exists('curl_init')) { @@ -263,7 +263,7 @@ if (\OC_Util::runningOnWindows()) { $matches = array(); preg_match('/Content-Length: (\d+)/', $data, $matches); if (isset($matches[1])) { - return (float) $matches[1]; + return 0 + $matches[1]; } } } @@ -274,7 +274,7 @@ if (\OC_Util::runningOnWindows()) { /** * @brief Tries to get the filesize via COM and exec(). * @param string $fullPath - * @return mixed Number of bytes as float on success, null otherwise. + * @return mixed Number of bytes on success, null otherwise. */ private static function getFileSizeFromOS($fullPath) { $name = strtolower(php_uname('s')); @@ -287,11 +287,11 @@ if (\OC_Util::runningOnWindows()) { } } else if (strpos($name, 'bsd') !== false) { if (\OC_Helper::is_function_enabled('exec')) { - return (float)exec('stat -f %z ' . escapeshellarg($fullPath)); + return 0 + exec('stat -f %z ' . escapeshellarg($fullPath)); } } else if (strpos($name, 'linux') !== false) { if (\OC_Helper::is_function_enabled('exec')) { - return (float)exec('stat -c %s ' . escapeshellarg($fullPath)); + return 0 + exec('stat -c %s ' . escapeshellarg($fullPath)); } } else { \OC_Log::write('core',