Closed
Description
В настоящий момент при импорте пустой строки в любом случае (даже если не задана минимальная длина строки через setMin) не получаем в value пустую строку, а получаем null, хотя это разные значения (в том числе и для БД). Есть предложение изменить на следующий код:
public function import($scope)
{
if (!BasePrimitive::import($scope))
return null;
if (!is_scalar($scope[$this->name]) || is_bool($scope[$this->name]))
return false;
$this->value = (string) $scope[$this->name];
$this->selfFilter();
if (is_string($this->value)) {
$length = mb_strlen($this->value);
if(
($this->max === null || $length <= $this->max)
&& ($this->min === null || $length >= $this->min)
&& ($this->pattern === null || preg_match($this->pattern, $this->value))
)
return true;
}
$this->value = null;
return false;
}
Metadata
Metadata
Assignees
Labels
No labels