From c2e6bdfce71792b97d9eb76e4ffd9b83b1af71af Mon Sep 17 00:00:00 2001 From: Brad Jorsch Date: Thu, 30 Oct 2014 13:30:45 -0400 Subject: [PATCH] API: Fix simplified continuation module skipping The simplified continuation includes a continuation parameter to indicate when the prop/list/meta modules are complete, so it can skip executing them. But if someone submitted a malformed value for 'continue', it might decide that the generator was complete but still try to uselessly execute the prop modules. Bug: 72764 Change-Id: I6af24e5d4f30e64782fb7dd1c2211ebdd4ec2317 --- includes/api/ApiQueryBase.php | 4 ++++ includes/api/ApiResult.php | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/includes/api/ApiQueryBase.php b/includes/api/ApiQueryBase.php index b1581f3152..998cc91c63 100644 --- a/includes/api/ApiQueryBase.php +++ b/includes/api/ApiQueryBase.php @@ -70,6 +70,10 @@ abstract class ApiQueryBase extends ApiBase { /** * Override this method to request extra fields from the pageSet * using $pageSet->requestField('fieldName') + * + * Note this only makes sense for 'prop' modules, as 'list' and 'meta' + * modules should not be using the pageset. + * * @param ApiPageSet $pageSet */ public function requestExtraData( $pageSet ) { diff --git a/includes/api/ApiResult.php b/includes/api/ApiResult.php index 946977d97f..5bc2efbc70 100644 --- a/includes/api/ApiResult.php +++ b/includes/api/ApiResult.php @@ -481,10 +481,14 @@ class ApiResult extends ApiBase { $continue = explode( '||', $continue ); $this->dieContinueUsageIf( count( $continue ) !== 2 ); $this->generatorDone = ( $continue[0] === '-' ); + $skip = explode( '|', $continue[1] ); if ( !$this->generatorDone ) { $this->generatorParams = explode( '|', $continue[0] ); + } else { + // When the generator is complete, don't run any modules that + // depend on it. + $skip += $this->continueGeneratedModules; } - $skip = explode( '|', $continue[1] ); } $this->continueAllModules = array(); -- 2.20.1