[4/4] Check return value of get_extended_fields()

Message ID 20170418065254.8200-4-lfleischer@archlinux.org
State Accepted, archived
Headers show
Series
  • [1/4] Check query return value in pkgbase_user_notify()
Related show

Commit Message

Lukas Fleischer April 18, 2017, 6:52 a.m. UTC
Make sure that the get_extended_fields() invocation succeeded before
merging regular and extended fields in process_query().

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
---
 web/lib/aurjson.class.php | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Patch

diff --git a/web/lib/aurjson.class.php b/web/lib/aurjson.class.php
index e07522d..9eeaafd 100644
--- a/web/lib/aurjson.class.php
+++ b/web/lib/aurjson.class.php
@@ -313,7 +313,10 @@  class AurJSON {
 				}
 
 				if ($this->version >= 2 && ($type == 'info' || $type == 'multiinfo')) {
-					$row = array_merge($row, $this->get_extended_fields($row['ID'], $row['PackageBaseID']));
+					$extfields = $this->get_extended_fields($row['ID'], $row['PackageBaseID']);
+					if ($extfields) {
+						$row = array_merge($row, $extfields);
+					}
 				}
 
 				if ($this->version < 3) {