[aur-dev] [PATCH] RPC: Coerce numeric values into integers

Lukas Fleischer archlinux at cryptocrack.de
Sat Aug 20 19:51:44 EDT 2011


Coerce "ID", "FirstSubmitted" and "LastModified" into integers to ensure
json_encode() serializes them as numeric values. This means that there
will be a minor API break. There doesn't seem to be a better way to do
this properly, though. Fixes FS#25693.

Signed-off-by: Lukas Fleischer <archlinux at cryptocrack.de>
---
 web/lib/aurjson.class.php |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/web/lib/aurjson.class.php b/web/lib/aurjson.class.php
index 277c824..ad99529 100644
--- a/web/lib/aurjson.class.php
+++ b/web/lib/aurjson.class.php
@@ -126,6 +126,9 @@ class AurJSON {
             while ( $row = mysql_fetch_assoc($result) ) {
                 $name = $row['Name'];
                 $row['URLPath'] = URL_DIR . substr($name, 0, 2) . "/" . $name . "/" . $name . ".tar.gz";
+                $row['ID'] = intval($row['ID']);
+                $row['FirstSubmitted'] = intval($row['FirstSubmitted']);
+                $row['LastModified'] = intval($row['LastModified']);
 
                 if ($type == 'info') {
                     $search_data = $row;
-- 
1.7.6



More information about the aur-dev mailing list