Skip to content

Commit

Permalink
fix(filestore): Fixed a crash when forms had a file input but no file
Browse files Browse the repository at this point in the history
was provided

If a form has an input/file, but no file was uploaded the system could
crash because of incorrect checks
  • Loading branch information
jeabakker committed Apr 30, 2015
1 parent 9b31f7c commit 2ada5d5
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion engine/lib/filestore.php
Expand Up @@ -47,6 +47,10 @@ function get_uploaded_file($input_name) {
}

$file = $files->get($input_name);
if (empty($file)) {
// a file input was provided but no file uploaded
return false;
}
if ($file->getError() !== 0) {
return false;
}
Expand Down Expand Up @@ -74,8 +78,12 @@ function get_resized_image_from_uploaded_file($input_name, $maxwidth, $maxheight
if (!$files->has($input_name)) {
return false;
}

$file = $files->get($input_name);

if (empty($file)) {
// a file input was provided but no file uploaded
return false;
}
if ($file->getError() !== 0) {
return false;
}
Expand Down

0 comments on commit 2ada5d5

Please sign in to comment.