Skip to content

Commit

Permalink
fix #12947 - Parameter 'message' must be a string in FileValidator
Browse files Browse the repository at this point in the history
  • Loading branch information
Zaszczyk committed Jul 19, 2017
1 parent 0033ef5 commit 668a68c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions phalcon/validation/validator/file.zep
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ class File extends Validator
}

if !isset value["error"] || !isset value["tmp_name"] || value["error"] !== UPLOAD_ERR_OK || !is_uploaded_file(value["tmp_name"]) {
let message = this->prepareMessage(validation, field, "FileEmpty", "messageEmpty");
let message = this->prepareMessage(validation, field, "FileEmpty", "messageEmpty"),
replacePairs = [":field": label];

validation->appendMessage(
new Message(
Expand All @@ -137,7 +138,8 @@ class File extends Validator
}

if !isset value["name"] || !isset value["type"] || !isset value["size"] {
let message = this->prepareMessage(validation, field, "FileValid", "messageValid");
let message = this->prepareMessage(validation, field, "FileValid", "messageValid"),
replacePairs = [":field": label];

validation->appendMessage(
new Message(
Expand Down Expand Up @@ -171,7 +173,8 @@ class File extends Validator
let bytes = floatval(matches[1]) * pow(2, byteUnits[unit]);

if floatval(value["size"]) > floatval(bytes) {
let message = this->prepareMessage(validation, field, "FileSize", "messageSize");
let message = this->prepareMessage(validation, field, "FileSize", "messageSize"),
replacePairs = [":field": label, ":max": maxSize];

validation->appendMessage(
new Message(
Expand Down

0 comments on commit 668a68c

Please sign in to comment.