Fixes FS#45537.

Signed-off-by: Johannes Löthberg <[email protected]>
---
Another take on fixing FS#45537, makes 
<[email protected]>
obsolete

 web/lib/aurjson.class.php | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/web/lib/aurjson.class.php b/web/lib/aurjson.class.php
index 7b77da4..f73d0c0 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']));
                                }
-- 
2.4.5

Reply via email to