From ea59f7277849c9f37a166375293d57bdd97bb20b Mon Sep 17 00:00:00 2001 From: Johannes Löthberg Date: Sat, 4 Jul 2015 12:31:41 +0200 Subject: RPC: Add decimal_fields array for floating-point fields MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes FS#45537. Signed-off-by: Johannes Löthberg Signed-off-by: Lukas Fleischer --- web/lib/aurjson.class.php | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'web/lib') diff --git a/web/lib/aurjson.class.php b/web/lib/aurjson.class.php index 7b77da4..debffc4 100644 --- a/web/lib/aurjson.class.php +++ b/web/lib/aurjson.class.php @@ -45,6 +45,9 @@ class AurJSON { 'ID', 'PackageBaseID', 'NumVotes', 'OutOfDate', 'FirstSubmitted', 'LastModified' ); + private static $decimal_fields = array( + 'Popularity' + ); /* * Handles post data, and routes the request. @@ -255,6 +258,10 @@ class AurJSON { $row[$field] = intval($row[$field]); } + foreach (self::$decimal_fields as $field) { + $row[$field] = floatval($row[$field]); + } + if ($this->version >= 2 && ($type == 'info' || $type == 'multiinfo')) { $row = array_merge($row, $this->get_extended_fields($row['ID'])); } -- cgit v1.2.3-54-g00ecf