From 4307dc1ae6cecbde2b9a3e547ac4d39ef76c2ddd Mon Sep 17 00:00:00 2001 From: MicroVB INC Date: Fri, 18 Mar 2016 08:28:40 -0400 Subject: [PATCH] Added check tor stat results When `$file` is a folder, the commands `filesize` and `filemtime` would result in the following warnings : PHP Warning: filemtime(): stat failed for /var/www/html/css in /var/www/html/ice/lib/file-control-xhr.php on line 921 PHP Warning: filesize(): stat failed for /var/www/html/css in /var/www/html/ice/lib/file-control-xhr.php on line 940 This patch corrects this. --- lib/file-control-xhr.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/file-control-xhr.php b/lib/file-control-xhr.php index 0b313d1..a867d97 100644 --- a/lib/file-control-xhr.php +++ b/lib/file-control-xhr.php @@ -917,7 +917,7 @@ if (!isset($ftpSite) && !$error && $_GET['action']=="checkExists") { // =================== // No $filemtime yet? Get it now! -if (!isset($filemtime)) { +if (!isset($filemtime) && !is_dir($file)) { $filemtime = $serverType=="Linux" ? filemtime($file) : "1000000"; } // Set $timeStart, use 0 if not available @@ -937,7 +937,7 @@ if (isset($ftpSite)) { } else { $itemAbsPath = $file; $itemPath = dirname($file); - $itemBytes = filesize($file); + $itemBytes = is_dir($file) ? null : filesize($file); $itemType = (file_exists($file) ? (is_dir($file) ? "dir" : "file") : "unknown"); $itemExists = (file_exists($file) ? "true" : "false"); }