jenkins-bot has submitted this change and it was merged.

Change subject: Check array index 'query' before accessing
......................................................................


Check array index 'query' before accessing

This fixes T109602 (logspam)

Full error message:
"Undefined index: query in 
/srv/mediawiki/php-1.26wmf19/extensions/CirrusSearch/includes/ElasticsearchIntermediary.php
 on line 127"

Bug: T109602
Change-Id: I7a86a38f43dc9e71f4429076aee964e77bf981b3
---
M includes/ElasticsearchIntermediary.php
1 file changed, 4 insertions(+), 2 deletions(-)

Approvals:
  20after4: Looks good to me, approved
  jenkins-bot: Verified

Objections:
  Cindy-the-browser-test-bot: There's a problem with this change, please improve



diff --git a/includes/ElasticsearchIntermediary.php 
b/includes/ElasticsearchIntermediary.php
index a93e9ad..1f8022b 100644
--- a/includes/ElasticsearchIntermediary.php
+++ b/includes/ElasticsearchIntermediary.php
@@ -124,7 +124,9 @@
                $hits = 0;
                foreach ( self::$logContexts as $context ) {
                        $hits += isset( $context['hitsTotal'] ) ? 
$context['hitsTotal'] : 0;
-                       $queries[] = $context['query'];
+                       if ( isset( $context['query'] ) ) {
+                               $queries[] = $context['query'];
+                       }
                        if ( isset( $context['elasticTookMs'] ) ) {
                                $elasticTook += $context['elasticTookMs'];
                        }
@@ -134,8 +136,8 @@
                        if ( isset( $context['queryType'] ) ) {
                                $parameters['queryType'][] = 
$context['queryType'];
                        }
-
                }
+
                foreach ( array( 'index', 'queryType' ) as $key ) {
                        $parameters[$key] = array_unique( $parameters[$key] );
                }

-- 
To view, visit https://gerrit.wikimedia.org/r/232784
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I7a86a38f43dc9e71f4429076aee964e77bf981b3
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: master
Gerrit-Owner: 20after4 <[email protected]>
Gerrit-Reviewer: 20after4 <[email protected]>
Gerrit-Reviewer: Chad <[email protected]>
Gerrit-Reviewer: Cindy-the-browser-test-bot <[email protected]>
Gerrit-Reviewer: DCausse <[email protected]>
Gerrit-Reviewer: EBernhardson <[email protected]>
Gerrit-Reviewer: Manybubbles <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to