mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
aurjson.class.php: Fix "Undefined index" notices
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
This commit is contained in:
parent
df160b61e8
commit
2f8e0dfa3a
1 changed files with 8 additions and 4 deletions
|
@ -110,8 +110,8 @@ class AurJSON {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isset($http_data['callback'])) {
|
||||||
$callback = $http_data['callback'];
|
$callback = $http_data['callback'];
|
||||||
if (isset($callback)) {
|
|
||||||
if (!preg_match('/^[a-zA-Z0-9().]{1,128}$/D', $callback)) {
|
if (!preg_match('/^[a-zA-Z0-9().]{1,128}$/D', $callback)) {
|
||||||
return $this->json_error('Invalid callback name.');
|
return $this->json_error('Invalid callback name.');
|
||||||
}
|
}
|
||||||
|
@ -281,12 +281,16 @@ class AurJSON {
|
||||||
* proper data types in the JSON response.
|
* proper data types in the JSON response.
|
||||||
*/
|
*/
|
||||||
foreach (self::$numeric_fields as $field) {
|
foreach (self::$numeric_fields as $field) {
|
||||||
|
if (isset($row[$field])) {
|
||||||
$row[$field] = intval($row[$field]);
|
$row[$field] = intval($row[$field]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
foreach (self::$decimal_fields as $field) {
|
foreach (self::$decimal_fields as $field) {
|
||||||
|
if (isset($row[$field])) {
|
||||||
$row[$field] = floatval($row[$field]);
|
$row[$field] = floatval($row[$field]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->version >= 2 && ($type == 'info' || $type == 'multiinfo')) {
|
if ($this->version >= 2 && ($type == 'info' || $type == 'multiinfo')) {
|
||||||
$row = array_merge($row, $this->get_extended_fields($row['ID']));
|
$row = array_merge($row, $this->get_extended_fields($row['ID']));
|
||||||
|
|
Loading…
Add table
Reference in a new issue