Skip to content

Commit 424607a

Browse files
Robbtfalkenhawk
authored andcommitted
Added null check to avoid errors with passing null to a count parameter (zf1#1)
* Added null check to avoid errors with passing null to a count parameter * treated _count as 0 in case of _file being null to avoid 7.2 count error
1 parent 065da57 commit 424607a

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

library/Zend/Validate/File/Count.php

+1-4
Original file line numberDiff line numberDiff line change
@@ -253,16 +253,13 @@ public function isValid($value, $file = null)
253253
if (($file === null) || !empty($file['tmp_name'])) {
254254
$this->addFile($value);
255255
}
256-
257-
$this->_count = count($this->_files);
256+
$this->_count = $this->_files !== null ? count($this->_files) : 0;
258257
if (($this->_max !== null) && ($this->_count > $this->_max)) {
259258
return $this->_throw($file, self::TOO_MANY);
260259
}
261-
262260
if (($this->_min !== null) && ($this->_count < $this->_min)) {
263261
return $this->_throw($file, self::TOO_FEW);
264262
}
265-
266263
return true;
267264
}
268265

0 commit comments

Comments
 (0)