RPC: Add decimal_fields array for floating-point fields

Fixes FS#45537.

Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
This commit is contained in:
Johannes Löthberg 2015-07-04 12:31:41 +02:00 committed by Lukas Fleischer
parent feeda37bb7
commit ea59f72778

View file

@ -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']));
}