Throw error in filterValue() if an unstringable object is given

This commit is contained in:
Kijin Sung 2025-09-15 00:30:00 +09:00
parent 85be8b7669
commit 60552ba96b

View file

@ -398,7 +398,11 @@ class VariableBase
// Don't apply a filter if there is no variable.
$column = $this instanceof ColumnWrite ? $this->name : $this->column;
$filter = isset($this->filter) ? $this->filter : '';
if (!is_array($value) && strval($value) === '')
if (is_object($value) && !method_exists($value, '__toString'))
{
throw new \Rhymix\Framework\Exceptions\QueryError('Variable ' . $this->var . ' for column ' . $column . ' is not stringable');
}
if (is_scalar($value) && strval($value) === '')
{
$filter = '';
}