diff --git a/src/ORM/Connect/PDOStatementHandle.php b/src/ORM/Connect/PDOStatementHandle.php index 259e71091..4eae21fef 100644 --- a/src/ORM/Connect/PDOStatementHandle.php +++ b/src/ORM/Connect/PDOStatementHandle.php @@ -47,6 +47,7 @@ class PDOStatementHandle 'float8' => 'float', 'float16' => 'float', 'numeric' => 'float', + 'bool' => 'int', // Bools should be ints // MySQL 'NEWDECIMAL' => 'float', diff --git a/tests/php/ORM/DatabaseTest.php b/tests/php/ORM/DatabaseTest.php index a13ff7d97..babcdb402 100644 --- a/tests/php/ORM/DatabaseTest.php +++ b/tests/php/ORM/DatabaseTest.php @@ -267,5 +267,9 @@ class DatabaseTest extends SapphireTest // Dates are returned as strings $this->assertInternalType('string', $record['Created'], 'DBDatetime fields should be string (non-prepared)'); + + // Booleans selected directly are ints + $result = DB::query('SELECT TRUE')->first(); + $this->assertInternalType('int', reset($result)); } }