diff options
author | Christian Weber | 2007-05-08 14:05:31 +0000 |
---|---|---|
committer | Christian Weber | 2007-05-08 14:05:31 +0000 |
commit | f43af745e8c07b72ea9453163438d8ddce753841 (patch) | |
tree | 63758d28bbf824cf40536b519e6884760308b4bd | |
parent | c84555e7d240010014b790e3cf16c0e15e22e633 (diff) | |
download | itools-f43af745e8c07b72ea9453163438d8ddce753841.tar.gz itools-f43af745e8c07b72ea9453163438d8ddce753841.tar.bz2 itools-f43af745e8c07b72ea9453163438d8ddce753841.zip |
encode() correctly encodes boolean values
-rw-r--r-- | itjs.class | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -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; |