From 08697eb433598c57184222cce96372dfc11eb229 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Gerg=C5=91=20Tisza?= Date: Fri, 2 Aug 2019 15:41:36 +0200 Subject: [PATCH] Avoid error in querypage API when there's no value field QueryPage does not require a value field, and post I8b67268e omitting it might even be useful, so the API should not error out when it's not present. Change-Id: I83b49d4451ba71bb2161459bddf17b9ac00088d2 --- includes/api/ApiQueryQueryPage.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/includes/api/ApiQueryQueryPage.php b/includes/api/ApiQueryQueryPage.php index ea2066490e..26c17c59b8 100644 --- a/includes/api/ApiQueryQueryPage.php +++ b/includes/api/ApiQueryQueryPage.php @@ -122,9 +122,12 @@ class ApiQueryQueryPage extends ApiQueryGeneratorBase { $title = Title::makeTitle( $row->namespace, $row->title ); if ( is_null( $resultPageSet ) ) { - $data = [ 'value' => $row->value ]; - if ( $qp->usesTimestamps() ) { - $data['timestamp'] = wfTimestamp( TS_ISO_8601, $row->value ); + $data = []; + if ( isset( $row->value ) ) { + $data['value'] = $row->value; + if ( $qp->usesTimestamps() ) { + $data['timestamp'] = wfTimestamp( TS_ISO_8601, $row->value ); + } } self::addTitleInfo( $data, $title ); -- 2.20.1