Skip to content

Commit 9f42f82

Browse files
author
Phil Sturgeon
committed
FALSE values were coming out as empty strings in xml or rawxml mode, now they will be 0/1.
1 parent ee778d6 commit 9f42f82

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

application/libraries/REST_Controller.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -685,8 +685,10 @@ private function _format_xml($data = array(), $structure = NULL, $basenode = 'xm
685685

686686
else
687687
{
688-
// add single node.
688+
// Actual boolean values need to be converted to numbers
689+
is_bool($value) AND $value = (int) $value;
689690

691+
// add single node.
690692
$value = htmlentities($value, ENT_NOQUOTES, "UTF-8");
691693

692694
$UsedKeys[] = $key;
@@ -736,10 +738,13 @@ private function _format_rawxml($data = array(), $structure = NULL, $basenode =
736738
// recrusive call.
737739
$this->_format_rawxml($value, $node, $basenode);
738740
}
741+
739742
else
740743
{
741-
// add single node.
744+
// Actual boolean values need to be converted to numbers
745+
is_bool($value) AND $value = (int) $value;
742746

747+
// add single node.
743748
$value = htmlentities($value, ENT_NOQUOTES, "UTF-8");
744749

745750
$UsedKeys[] = $key;
@@ -800,7 +805,7 @@ private function _format_csv($data = array())
800805
$output = implode(',', $headings)."\r\n";
801806
foreach($data as &$row)
802807
{
803-
$output .= '"'.implode('","',$row)."\"\r\n";
808+
$output .= '"'.implode('","', $row)."\"\r\n";
804809
}
805810

806811
return $output;

0 commit comments

Comments
 (0)