From 1ad0bfb165007b043388eb302bb67d24a5f25aad Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Thu, 27 Nov 2008 00:00:35 +0000 Subject: [PATCH] Improved boolean field handling for postgres git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@66792 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- core/model/fieldtypes/Boolean.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/core/model/fieldtypes/Boolean.php b/core/model/fieldtypes/Boolean.php index 7552f416b..561cd8031 100644 --- a/core/model/fieldtypes/Boolean.php +++ b/core/model/fieldtypes/Boolean.php @@ -47,12 +47,10 @@ class Boolean extends DBField { * If necessary, this should include quotes. */ function prepValueForDB($value) { - if($value === true || $value === 1 || $value === '1') { + if($value && strtolower($value) != 'f') { return "'1'"; - } if(!$value || !is_numeric($value)) { - return "'0'"; } else { - return addslashes($value); + return "'0'"; } }