[DDC-1683] Fix bug with booleans not handled by Expr#literal() in query builder.
This commit is contained in:
parent
9b4d60897d
commit
18f1d56b60
@ -562,6 +562,8 @@ class Expr
|
||||
{
|
||||
if (is_numeric($literal) && !is_string($literal)) {
|
||||
return (string) $literal;
|
||||
} else if (is_bool($literal)) {
|
||||
return $literal ? "true" : "false";
|
||||
} else {
|
||||
return "'" . str_replace("'", "''", $literal) . "'";
|
||||
}
|
||||
|
@ -336,4 +336,13 @@ class ExprTest extends \Doctrine\Tests\OrmTestCase
|
||||
$orExpr = $this->_expr->orx();
|
||||
$orExpr->add($this->_expr->quot(5, 2));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @group DDC-1683
|
||||
*/
|
||||
public function testBooleanLiteral()
|
||||
{
|
||||
$this->assertEquals('true', $this->_expr->literal(true));
|
||||
$this->assertEquals('false', $this->_expr->literal(false));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user