Skip to content
This repository was archived by the owner on Oct 2, 2019. It is now read-only.

Commit 10d8c93

Browse files
author
Joan He
authored
Merge pull request #14 from magento-engcom/MAGETWO-89875
MAGETWO-89875: null passed to count() call in Zend/Validate/File/Uplo…
2 parents d99ca64 + 34a90a1 commit 10d8c93

File tree

4 files changed

+5
-21
lines changed

4 files changed

+5
-21
lines changed

library/Zend/Validate/File/FilesSize.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,6 @@ public function isValid($value, $file = null)
155155
}
156156
}
157157

158-
if (count($this->_messages) > 0) {
159-
return false;
160-
}
161-
162-
return true;
158+
return !empty($this->_messages);
163159
}
164160
}

library/Zend/Validate/File/ImageSize.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -338,11 +338,7 @@ public function isValid($value, $file = null)
338338
$this->_throw($file, self::HEIGHT_TOO_BIG);
339339
}
340340

341-
if (count($this->_messages) > 0) {
342-
return false;
343-
}
344-
345-
return true;
341+
return !empty($this->_messages);
346342
}
347343

348344
/**

library/Zend/Validate/File/Size.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -312,11 +312,7 @@ public function isValid($value, $file = null)
312312
}
313313
}
314314

315-
if (count($this->_messages) > 0) {
316-
return false;
317-
}
318-
319-
return true;
315+
return !empty($this->_messages);
320316
}
321317

322318
/**

library/Zend/Validate/File/Upload.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ public function setFiles($files = array())
161161
*/
162162
public function isValid($value, $file = null)
163163
{
164-
$this->_messages = null;
164+
$this->_messages = [];
165165
if (array_key_exists($value, $this->_files)) {
166166
$files[$value] = $this->_files[$value];
167167
} else {
@@ -223,11 +223,7 @@ public function isValid($value, $file = null)
223223
}
224224
}
225225

226-
if (count($this->_messages) > 0) {
227-
return false;
228-
} else {
229-
return true;
230-
}
226+
return !empty($this->_messages);
231227
}
232228

233229
/**

0 commit comments

Comments
 (0)