summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Weber2007-05-08 14:05:31 +0000
committerChristian Weber2007-05-08 14:05:31 +0000
commitf43af745e8c07b72ea9453163438d8ddce753841 (patch)
tree63758d28bbf824cf40536b519e6884760308b4bd
parentc84555e7d240010014b790e3cf16c0e15e22e633 (diff)
downloaditools-f43af745e8c07b72ea9453163438d8ddce753841.tar.gz
itools-f43af745e8c07b72ea9453163438d8ddce753841.tar.bz2
itools-f43af745e8c07b72ea9453163438d8ddce753841.zip
encode() correctly encodes boolean values
-rw-r--r--itjs.class6
1 files changed, 5 insertions, 1 deletions
diff --git a/itjs.class b/itjs.class
index e49f98f..c7ab607 100644
--- a/itjs.class
+++ b/itjs.class
@@ -65,7 +65,11 @@ function encode($values)
$result .= "$key:";
}
- if (!is_array($value))
+ if ($value === true)
+ $result .= 'true';
+ else if ($value === false)
+ $result .= 'false';
+ else if (!is_array($value))
{
$quote = (strval(intval($value)) === strval($value)) ? "" : '"';
$result .= $quote . strtr($value, array("\0" => '\\0', '"' => '\\"', "</"=>"<\\/", "\n" => '\\n', "\r" => '\\r', "\t" => '\\t', "\\" => '\\\\')) . $quote;