Cast API timeSpentBackend to an int
authorBryan Davis <bd808@wikimedia.org>
Thu, 17 Mar 2016 22:16:25 +0000 (16:16 -0600)
committerOri.livneh <ori@wikimedia.org>
Thu, 17 Mar 2016 22:21:36 +0000 (22:21 +0000)
Fixes {"timeSpentBackend":"Expected integer, but received double"} Avro
encoding error.

Bug: T108618
Change-Id: Iea79d14afe0ef0d1a9ea88096b7bbd90083df757

includes/api/ApiMain.php

index f09c6f2..074cca5 100644 (file)
@@ -1367,7 +1367,7 @@ class ApiMain extends ApiBase {
                        'ip' => $request->getIP(),
                        'userAgent' => $this->getUserAgent(),
                        'wiki' => wfWikiID(),
-                       'timeSpentBackend' => round( $time * 1000 ),
+                       'timeSpentBackend' => (int) round( $time * 1000 ),
                        'hadError' => $e !== null,
                        'errorCodes' => [],
                        'params' => [],