1
0
mirror of synced 2025-01-29 19:41:45 +03:00

[DDC-1683] Fix bug with booleans not handled by Expr#literal() in query builder.

This commit is contained in:
Benjamin Eberlei 2012-03-14 20:49:25 +01:00
parent 9b4d60897d
commit 18f1d56b60
2 changed files with 12 additions and 1 deletions

View File

@ -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) . "'";
}

View File

@ -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));
}
}