Commit dea12d61 authored by Carsten  Rose's avatar Carsten Rose
Browse files

stat(): throws an exception, if file does not exsist - implement file_exist()...

stat(): throws an exception, if file does not exsist - implement file_exist() before doing a stat().
parent b1c43b3b
......@@ -772,7 +772,7 @@ class QuickFormQuery {
foreach ([FORM_LOG_SESSION, FORM_LOG_ALL] as $mode) {
$file = Support::getFormLogFileName($form[F_NAME], $mode);
if (false !== ($arr = stat($file))) {
if (file_exists($file) && false !== ($arr = stat($file))) {
if (time() - $arr['mtime'] > FORM_LOG_FILE_EXPIRE) {
HelperFile::unlink($file);
......
......@@ -105,14 +105,17 @@ class Thumbnail {
*/
private function getOrCreateThumbnail($pathFilenameSource, $pathFilenameThumbnail, array $control, $modeRender) {
$debugMode = false;
$statThumbnail=false;
$statSource = stat($pathFilenameSource);
$statThumbnail = stat($pathFilenameThumbnail);
if ($statSource === false) {
// Using stat() on non existing files throws an exception
if (!file_exists($pathFilenameSource) || false === ($statSource = stat($pathFilenameSource))) {
throw new UserFormException('File not found: "' . OnString::strrstr($pathFilenameSource, '/') . '"', ERROR_IO_FILE_NOT_FOUND);
}
if(file_exists($pathFilenameThumbnail)) {
$statThumbnail = stat($pathFilenameThumbnail);
}
// thumbnail already exist?
if ($statThumbnail !== false) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment