Fix error handling issues

This commit is contained in:
Kijin Sung 2020-06-30 12:16:59 +09:00
parent 936568a8a5
commit 978d3d167a
4 changed files with 37 additions and 12 deletions

View file

@ -366,7 +366,7 @@ class VariableBase
}
// Check minimum and maximum lengths.
$length = iconv_strlen($value, 'UTF-8');
$length = is_scalar($value) ? iconv_strlen($value, 'UTF-8') : (is_countable($value) ? count($value) : 1);
if (isset($this->minlength) && $this->minlength > 0 && $length < $this->minlength)
{
throw new \Rhymix\Framework\Exceptions\QueryError('Variable ' . $this->var . ' for column ' . $this->column . ' must contain no less than ' . $this->minlength . ' characters');