Cast row namespace to int in SpecialWatchlist
authoraddshore <addshorewiki@gmail.com>
Thu, 24 Mar 2016 10:43:58 +0000 (10:43 +0000)
committeraddshore <addshorewiki@gmail.com>
Thu, 24 Mar 2016 10:43:58 +0000 (10:43 +0000)
Something similar to this recently got through
and caused exceptions on mw.org

This looks like the same thing, a ns from a db row
being handed straight to the TitleValue constructor
without being cast.

Change-Id: Ic126cd713c5210c9ae3d8e805081849ccf84a7f6

includes/specials/SpecialWatchlist.php

index 2dda093..27e5829 100644 (file)
@@ -382,7 +382,7 @@ class SpecialWatchlist extends ChangesListSpecialPage {
                        }
 
                        if ( isset( $watchedItemStore ) ) {
-                               $rcTitleValue = new TitleValue( $obj->rc_namespace, $obj->rc_title );
+                               $rcTitleValue = new TitleValue( (int)$obj->rc_namespace, $obj->rc_title );
                                $rc->numberofWatchingusers = $watchedItemStore->countWatchers( $rcTitleValue );
                        } else {
                                $rc->numberofWatchingusers = 0;