diff options
author | Johannes Löthberg <johannes@kyriasis.com> | 2015-07-04 12:25:13 +0200 |
---|---|---|
committer | Johannes Löthberg <johannes@kyriasis.com> | 2015-07-04 12:30:24 +0200 |
commit | 97ea0995b4c3e6a9b354421522c7c4f6748b3524 (patch) | |
tree | 1a4670f927ae4b5135acc1114ac846e08830a554 | |
parent | feeda37bb754a57c480fdd58d68701d7853928f6 (diff) | |
download | aurweb-json-numerics.tar.xz |
RPC: Add decimal_fields array for floating-point fieldsjson-numerics
Fixes FS#45537.
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
-rw-r--r-- | web/lib/aurjson.class.php | 7 |
1 files changed, 7 insertions, 0 deletions
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'])); } |