From 97ea0995b4c3e6a9b354421522c7c4f6748b3524 Mon Sep 17 00:00:00 2001 From: Johannes Löthberg Date: Sat, 4 Jul 2015 12:25:13 +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 --- web/lib/aurjson.class.php | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'web/lib/aurjson.class.php') 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-70-g09d2