Skip to content

Commit

Permalink
MAGETWO-89875: null passed to count() call in Zend/Validate/File/Uplo…
Browse files Browse the repository at this point in the history
…ad.php
  • Loading branch information
Joan He committed Mar 30, 2018
1 parent d99ca64 commit 34a90a1
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 21 deletions.
6 changes: 1 addition & 5 deletions library/Zend/Validate/File/FilesSize.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,6 @@ public function isValid($value, $file = null)
}
}

if (count($this->_messages) > 0) {
return false;
}

return true;
return !empty($this->_messages);
}
}
6 changes: 1 addition & 5 deletions library/Zend/Validate/File/ImageSize.php
Original file line number Diff line number Diff line change
Expand Up @@ -338,11 +338,7 @@ public function isValid($value, $file = null)
$this->_throw($file, self::HEIGHT_TOO_BIG);
}

if (count($this->_messages) > 0) {
return false;
}

return true;
return !empty($this->_messages);
}

/**
Expand Down
6 changes: 1 addition & 5 deletions library/Zend/Validate/File/Size.php
Original file line number Diff line number Diff line change
Expand Up @@ -312,11 +312,7 @@ public function isValid($value, $file = null)
}
}

if (count($this->_messages) > 0) {
return false;
}

return true;
return !empty($this->_messages);
}

/**
Expand Down
8 changes: 2 additions & 6 deletions library/Zend/Validate/File/Upload.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public function setFiles($files = array())
*/
public function isValid($value, $file = null)
{
$this->_messages = null;
$this->_messages = [];
if (array_key_exists($value, $this->_files)) {
$files[$value] = $this->_files[$value];
} else {
Expand Down Expand Up @@ -223,11 +223,7 @@ public function isValid($value, $file = null)
}
}

if (count($this->_messages) > 0) {
return false;
} else {
return true;
}
return !empty($this->_messages);
}

/**
Expand Down

0 comments on commit 34a90a1

Please sign in to comment.