Merge "Revert "ApiSandbox: Display params as JSON on request page""
[lhc/web/wiklou.git] / includes / api / ApiPageSet.php
index 4cf896f..d42e306 100644 (file)
@@ -174,7 +174,10 @@ class ApiPageSet extends ApiBase {
                        // populate this pageset with the generator output
                        if ( !$isDryRun ) {
                                $generator->executeGenerator( $this );
-                               Hooks::run( 'APIQueryGeneratorAfterExecute', [ &$generator, &$this ] );
+
+                               // Avoid PHP 7.1 warning of passing $this by reference
+                               $apiModule = $this;
+                               Hooks::run( 'APIQueryGeneratorAfterExecute', [ &$generator, &$apiModule ] );
                        } else {
                                // Prevent warnings from being reported on these parameters
                                $main = $this->getMain();
@@ -1151,7 +1154,7 @@ class ApiPageSet extends ApiBase {
                                        $this->mAllPages[0][$title] = $this->mFakePageId;
                                        $this->mInvalidTitles[$this->mFakePageId] = [
                                                'title' => $title,
-                                               'invalidreason' => $ex->getMessage(),
+                                               'invalidreason' => $this->getErrorFormatter()->formatException( $ex, [ 'bc' => true ] ),
                                        ];
                                        $this->mFakePageId--;
                                        continue; // There's nothing else we can do