From: Kunal Mehta Date: Fri, 18 May 2018 05:18:20 +0000 (-0700) Subject: ApiCSPReport: Fix undefined $userAgent variable X-Git-Tag: 1.34.0-rc.0~5406 X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=bfb5cd8bb3d59185bfd313940fe4e9c7b60489b8 ApiCSPReport: Fix undefined $userAgent variable Bug: T194899 Change-Id: Ia83f961da1db2d1245859ae584db883b7a11081c --- diff --git a/includes/api/ApiCSPReport.php b/includes/api/ApiCSPReport.php index 42d1093d98..82a7cce44b 100644 --- a/includes/api/ApiCSPReport.php +++ b/includes/api/ApiCSPReport.php @@ -47,7 +47,7 @@ class ApiCSPReport extends ApiBase { $this->verifyPostBodyOk(); $report = $this->getReport(); - $flags = $this->getFlags( $report ); + $flags = $this->getFlags( $report, $userAgent ); $warningText = $this->generateLogLine( $flags, $report ); $this->logReport( $flags, $warningText, [ @@ -81,9 +81,10 @@ class ApiCSPReport extends ApiBase { * Get extra notes about the report. * * @param array $report The CSP report + * @param string $userAgent * @return array */ - private function getFlags( $report ) { + private function getFlags( $report, $userAgent ) { $reportOnly = $this->getParameter( 'reportonly' ); $source = $this->getParameter( 'source' ); $falsePositives = $this->getConfig()->get( 'CSPFalsePositiveUrls' ); @@ -137,7 +138,7 @@ class ApiCSPReport extends ApiBase { /** * Get the report from post body and turn into associative array. * - * @return Array + * @return array */ private function getReport() { $postBody = $this->getRequest()->getRawInput();