Ensure integer compare in Special:WantedCategories
authorumherirrender <umherirrender_de.wp@web.de>
Sat, 6 Dec 2014 12:34:12 +0000 (13:34 +0100)
committerUmherirrender <umherirrender_de.wp@web.de>
Sat, 6 Dec 2014 18:37:11 +0000 (18:37 +0000)
For some reasons the qc_value from the query is returned as string, not
integer. The strict unequal comparision gives always true and that
results in unwanted "1 -> 1 member". Added a intval call.

Bug: T76910
Change-Id: I26e2718e418f35e2e10565c747a8f06f2bbb5ba3

includes/specials/SpecialWantedcategories.php

index b8c0bb2..7ddafae 100644 (file)
@@ -109,6 +109,7 @@ class WantedCategoriesPage extends WantedQueryPage {
                        $currentValue = isset( $this->currentCategoryCounts[$result->title] )
                                ? $this->currentCategoryCounts[$result->title]
                                : 0;
+                       $cachedValue = intval( $result->value ); // T76910
 
                        // If the category has been created or emptied since the list was refreshed, strike it
                        if ( $nt->isKnown() || $currentValue === 0 ) {
@@ -116,11 +117,11 @@ class WantedCategoriesPage extends WantedQueryPage {
                        }
 
                        // Show the current number of category entries if it changed
-                       if ( $currentValue !== $result->value ) {
+                       if ( $currentValue !== $cachedValue ) {
                                $nlinks = $this->msg( 'nmemberschanged' )
-                                       ->numParams( $result->value, $currentValue )->escaped();
+                                       ->numParams( $cachedValue, $currentValue )->escaped();
                        } else {
-                               $nlinks = $this->msg( 'nmembers' )->numParams( $result->value )->escaped();
+                               $nlinks = $this->msg( 'nmembers' )->numParams( $cachedValue )->escaped();
                        }
                }