Fixed null values handling for PostgresSQL arrays

Fixes #15804
This commit is contained in:
SilverFire - Dmitry Naumenko
2018-03-03 18:54:33 +02:00
parent 233eeb52d7
commit d5d4b8b0f5
6 changed files with 36 additions and 3 deletions

View File

@@ -182,10 +182,14 @@ class ArrayExpression implements ExpressionInterface, \ArrayAccess, \Countable,
*/
public function getIterator()
{
if ($this->getValue() instanceof QueryInterface) {
$value = $this->getValue();
if ($value instanceof QueryInterface) {
throw new InvalidConfigException('The ArrayExpression class can not be iterated when the value is a QueryInterface object');
}
if ($value === null) {
$value = [];
}
return new \ArrayIterator($this->getValue());
return new \ArrayIterator($value);
}
}