Search code examples
phpmediawikimediawiki-extensions

FlaggedRevs error after PHP upgrade from 5.2 to 5.3


After upgrade I have an error when uploading new files:

Warning: Parameter 1 to FlaggedRevsHooks::imagePageFindFile() expected to be a reference, value given in /home/user/www/site.com/includes/Hooks.php on line 117 

Detected bug in an extension! Hook FlaggedRevsHooks::imagePageFindFile failed to return a value; should return true to continue hook processing or false to abort.

Backtrace:

#0 /home/user/www/site.com/includes/ImagePage.php(39): wfRunHooks('ImagePageFindFi...', Array)
#1 /home/user/www/site.com/includes/ImagePage.php(185): ImagePage->loadFile()
#2 /home/user/www/site.com/includes/Wiki.php(289): ImagePage->getFile()
#3 /home/user/www/site.com/includes/Wiki.php(60): MediaWiki->initializeArticle(Object(Title), Object(WebRequest))
#4 /home/user/www/site.com/index.php(116): MediaWiki->initialize(Object(Title), NULL, Object(OutputPage), Object(User), Object(WebRequest))
#5 {main}

MediaWiki version 1.15.5.


Solution

  • After comparing with version from 1.16.0 found a solution. In FlaggedRevs.hooks.php find:

    public static function imagePageFindFile( &$imagePage, &$normalFile, &$displayFile ) {
    

    And replace with:

    public static function imagePageFindFile( $imagePage, &$normalFile, &$displayFile ) {
    

    Find:

    public static function autoPromoteUser( $article, $user, &$text, &$summary, &$m, &$a, &$b, &$f, $rev ) {
    

    Replace with:

    public static function autoPromoteUser( $article, $user, $text, $summary, $m, $a, $b, &$f, $rev ) { 
    

    Find:

    public static function maybeNullEditReview( $article, $user, &$text, &$summary, &$m, &$a, &$b,
        &$f, $rev, &$s, $baseId )
    

    Replace with:

    public static function maybeNullEditReview( $article, $user, $text, $summary, $m, $a, $b,
        $f, $rev, &$s, $baseId )
    

    Find:

    public static function injectReviewDiffURLParams( &$article, &$sectionAnchor, &$extraQuery ) { 
    

    Replace with:

    public static function injectReviewDiffURLParams( $article, &$sectionAnchor, &$extraQuery ) {