diff options
author | Lukas Fleischer <lfleischer@archlinux.org> | 2015-09-24 18:27:21 +0200 |
---|---|---|
committer | Lukas Fleischer <lfleischer@archlinux.org> | 2015-09-25 08:35:43 +0200 |
commit | 2f8e0dfa3ac67a4225b27135977a48b124717762 (patch) | |
tree | 7d90fac119ad11b635638041c47bdae0bb1823d2 /web/lib/aurjson.class.php | |
parent | df160b61e87939689ec359926975892505aa2168 (diff) | |
download | aurweb-2f8e0dfa3ac67a4225b27135977a48b124717762.tar.xz |
aurjson.class.php: Fix "Undefined index" notices
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
Diffstat (limited to 'web/lib/aurjson.class.php')
-rw-r--r-- | web/lib/aurjson.class.php | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/web/lib/aurjson.class.php b/web/lib/aurjson.class.php index e646c63..304a50a 100644 --- a/web/lib/aurjson.class.php +++ b/web/lib/aurjson.class.php @@ -110,8 +110,8 @@ class AurJSON { return; } - $callback = $http_data['callback']; - if (isset($callback)) { + if (isset($http_data['callback'])) { + $callback = $http_data['callback']; if (!preg_match('/^[a-zA-Z0-9().]{1,128}$/D', $callback)) { return $this->json_error('Invalid callback name.'); } @@ -281,11 +281,15 @@ class AurJSON { * proper data types in the JSON response. */ foreach (self::$numeric_fields as $field) { - $row[$field] = intval($row[$field]); + if (isset($row[$field])) { + $row[$field] = intval($row[$field]); + } } foreach (self::$decimal_fields as $field) { - $row[$field] = floatval($row[$field]); + if (isset($row[$field])) { + $row[$field] = floatval($row[$field]); + } } if ($this->version >= 2 && ($type == 'info' || $type == 'multiinfo')) { |