From: Gergő Tisza Date: Fri, 2 Aug 2019 13:41:36 +0000 (+0200) Subject: Avoid error in querypage API when there's no value field X-Git-Tag: 1.34.0-rc.0~790^2 X-Git-Url: http://git.cyclocoop.org/%22.%24match%5B1%5D.%22?a=commitdiff_plain;h=08697eb433598c57184222cce96372dfc11eb229;p=lhc%2Fweb%2Fwiklou.git 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 --- 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 );