Open albertor24 opened 5 years ago
I am trying to create an expression that has zero as the parameter value. However, the parameters incorrectly show as empty.
$expr = new \Zend\Db\Sql\Expression('?', '0'); print_r($expr->getParameters());
It prints "0"
It prints empty array
https://github.com/zendframework/zend-db/blob/master/src/Sql/Expression.php#L59
In Zend\Db\Sql\Expression, update the constructor to explicitly check for '0' when setting parameters
Zend\Db\Sql\Expression
if ($parameters || $parameters === '0') { $this->setParameters($parameters); }
@albertor24 Please submit PR and add test to cover your case 👍
This repository has been closed and moved to laminas/laminas-db; a new issue has been opened at https://github.com/laminas/laminas-db/issues/6.
I am trying to create an expression that has zero as the parameter value. However, the parameters incorrectly show as empty.
Code to reproduce the issue
Expected results
It prints "0"
Actual results
It prints empty array
Proposed fix
https://github.com/zendframework/zend-db/blob/master/src/Sql/Expression.php#L59
In
Zend\Db\Sql\Expression
, update the constructor to explicitly check for '0' when setting parameters