-
Notifications
You must be signed in to change notification settings - Fork 2.5k
fix for FilesSize validator usage with Input #6731
Conversation
@@ -96,6 +98,16 @@ public function isValid($value, $file = null) | |||
$size = $this->getSize(); | |||
foreach ($value as $files) { | |||
// Is file readable ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move "Is file readable" comment on after your code addition
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
need test |
I've added a test. |
Apparently one of the Cache test fails on PHP 5.5. I don't see any direct links with the changed code though… |
} | ||
|
||
$min = $this->getMin(true); | ||
$max = $this->getMax(true); | ||
$size = $this->getSize(); | ||
foreach ($value as $files) { | ||
if (is_array($files)) { | ||
if (!isset($files['tmp_name']) || !isset($files['name'])) { | ||
throw new Exception\InvalidArgumentException( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This particular path seems to be uncovered by the test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not any more, as of afbfac7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
fix for FilesSize validator usage with Input
Merged to develop for release with 2.4. |
…filefilessize fix for FilesSize validator usage with Input
There's a problem with
FilesSize
when used as validator for aFileInput
: the validator doesn't accept input in the$_FILES
format. It expects a filename or an array of filenames.This PR adds support for the
$_FILES
format to theFilesSize
validator.