[Mediawiki-l] PHP 5.3 update and MediaWiki hook return values?

Daniel Barrett danb at VistaPrint.com
Mon Apr 11 18:52:45 UTC 2011


I updated our wiki server (1.16.2) from PHP 5.1.6 to PHP 5.3.3, and now MediaWiki is complaining about extensions not returning values in their hook functions, when they are definitely returning "true". Does this look familiar to anybody?

Example:

      $wgHooks['SkinAfterBottomScripts'][] = 'MyClass::addBottomScripts';

      class MyClass {
              static function addBottomScripts( &$sk, &$bottomScriptText ) {
                      return true;
              }
      }

Results on rendering a wiki page:

      MediaWiki internal error.

      Original exception: exception 'MWException' with message 'Detected bug in an extension! Hook MyClass::addBottomScripts failed to return a value; should return true to continue hook processing or false to abort.' in /var/www/html/w/includes/Hooks.php:155
      Stack trace:
      #0 /var/www/html/w/includes/Skin.php(978): wfRunHooks('SkinAfterBottom...', Array)
      #1 /var/www/html/w/includes/SkinTemplate.php(455): Skin->bottomScripts()
      #2 /var/www/html/w/includes/OutputPage.php(1615): SkinTemplate->outputPage(Object(OutputPage))
      #3 /var/www/html/w/includes/Wiki.php(376): OutputPage->output()
      #4 /var/www/html/w/index.php(118): MediaWiki->finalCleanup(Array, Object(OutputPage))
      #5 {main}

      Exception caught inside exception handler: exception 'MWException' with message 'Detected bug in an extension! Hook MyClass::addBottomScripts failed to return a value; should return true to continue hook processing or false to abort.' in /var/www/html/w/includes/Hooks.php:155
      Stack trace:
      #0 /var/www/html/w/includes/Skin.php(978): wfRunHooks('SkinAfterBottom...', Array)
      #1 /var/www/html/w/includes/SkinTemplate.php(455): Skin->bottomScripts()
      #2 /var/www/html/w/includes/OutputPage.php(1615): SkinTemplate->outputPage(Object(OutputPage))
      #3 /var/www/html/w/includes/Exception.php(164): OutputPage->output()
      #4 /var/www/html/w/includes/Exception.php(191): MWException->reportHTML()
      #5 /var/www/html/w/includes/Exception.php(289): MWException->report()
      #6 /var/www/html/w/includes/Exception.php(348): wfReportException(Object(MWException))
      #7 [internal function]: wfExceptionHandler(Object(MWException))
      #8 {main}

Thanks for any insights!
DanB



More information about the MediaWiki-l mailing list