From 689dd6b21444a783e35b4b08af2471a8c00043fb Mon Sep 17 00:00:00 2001
From: James Sansbury <james.sansbury@lullabot.com>
Date: Tue, 28 Aug 2012 14:27:32 -0400
Subject: [PATCH] Issue #1760752: Do not assume all tiny ints are boolean
 values when exporting.

---
 includes/export.inc |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/includes/export.inc b/includes/export.inc
index 6a76fbd..5a7ea62 100644
--- a/includes/export.inc
+++ b/includes/export.inc
@@ -1169,7 +1169,11 @@ function ctools_export_object($table, $object, $indent = '', $identifier = NULL,
     else {
       $value = $object->$field;
       if ($info['type'] == 'int') {
-        $value = (isset($info['size']) && $info['size'] == 'tiny') ? (bool) $value : (int) $value;
+        // Ensure that the value is cast as an int, so that integer values are
+        // not exported as strings. This could cause problems if this field is
+        // being used as a storage for boolean values, where the exported code
+        // might evaluate the string '0' as boolean FALSE.
+        $value = (int) $value;
       }
 
       $output .= $indent . '$' . $identifier . '->' . $field . ' = ' . ctools_var_export($value, $indent) . ";\n";
-- 
1.7.10.4

