Skip to content
Browse files

Making DboPostgres::value() return NULL when given an empty array, as…

… DboMysql does
  • Loading branch information...
1 parent ebde29f commit 75900883e68fc133e557dcd7194f4f33140e16f8 @lorenzo lorenzo committed
View
2 cake/libs/model/datasources/dbo/dbo_postgres.php
@@ -286,7 +286,7 @@ function value($data, $column = null, $read = true) {
return $parent;
}
- if ($data === null) {
+ if ($data === null || (is_array($data) && empty($data))) {
return 'NULL';
}
if (empty($column)) {
View
1 cake/tests/cases/libs/model/datasources/dbo/dbo_postgres.test.php
@@ -375,6 +375,7 @@ function testValueQuoting() {
$this->assertEqual($this->db2->value(1, 'boolean'), 'TRUE');
$this->assertEqual($this->db2->value('1', 'boolean'), 'TRUE');
$this->assertEqual($this->db2->value(null, 'boolean'), "NULL");
+ $this->assertEqual($this->db2->value(array()), "NULL");
}
/**

0 comments on commit 7590088

Please sign in to comment.
Something went wrong with that request. Please try again.