From 34a90a1e791c173073235d9e213a0d8235db399b Mon Sep 17 00:00:00 2001 From: Joan He Date: Fri, 30 Mar 2018 12:50:07 -0500 Subject: [PATCH] MAGETWO-89875: null passed to count() call in Zend/Validate/File/Upload.php --- library/Zend/Validate/File/FilesSize.php | 6 +----- library/Zend/Validate/File/ImageSize.php | 6 +----- library/Zend/Validate/File/Size.php | 6 +----- library/Zend/Validate/File/Upload.php | 8 ++------ 4 files changed, 5 insertions(+), 21 deletions(-) diff --git a/library/Zend/Validate/File/FilesSize.php b/library/Zend/Validate/File/FilesSize.php index dabff96df8..2452dc8d60 100644 --- a/library/Zend/Validate/File/FilesSize.php +++ b/library/Zend/Validate/File/FilesSize.php @@ -155,10 +155,6 @@ public function isValid($value, $file = null) } } - if (count($this->_messages) > 0) { - return false; - } - - return true; + return !empty($this->_messages); } } diff --git a/library/Zend/Validate/File/ImageSize.php b/library/Zend/Validate/File/ImageSize.php index c3c9f11ee5..239111bdf5 100644 --- a/library/Zend/Validate/File/ImageSize.php +++ b/library/Zend/Validate/File/ImageSize.php @@ -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); } /** diff --git a/library/Zend/Validate/File/Size.php b/library/Zend/Validate/File/Size.php index f0651154ec..a1df48d74a 100644 --- a/library/Zend/Validate/File/Size.php +++ b/library/Zend/Validate/File/Size.php @@ -312,11 +312,7 @@ public function isValid($value, $file = null) } } - if (count($this->_messages) > 0) { - return false; - } - - return true; + return !empty($this->_messages); } /** diff --git a/library/Zend/Validate/File/Upload.php b/library/Zend/Validate/File/Upload.php index 475b68cc3a..b691d4bb7c 100644 --- a/library/Zend/Validate/File/Upload.php +++ b/library/Zend/Validate/File/Upload.php @@ -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 { @@ -223,11 +223,7 @@ public function isValid($value, $file = null) } } - if (count($this->_messages) > 0) { - return false; - } else { - return true; - } + return !empty($this->_messages); } /**