Last modified: 2011-12-01 14:55:15 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T18313, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 16313 - Recent Hooks.php rewrite breaks onEventname hook functions
Recent Hooks.php rewrite breaks onEventname hook functions
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
General/Unknown (Other open bugs)
1.14.x
All All
: Highest blocker (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-11-11 14:24 UTC by Bertrand GRONDIN
Modified: 2011-12-01 14:55 UTC (History)
4 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
Possible patch (1.83 KB, patch)
2008-11-12 14:07 UTC, Brad Jorsch
Details

Description Bertrand GRONDIN 2008-11-11 14:24:52 UTC
In r43384n mediawiki crashed irremediably on loading. I've the following messages : 


Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'LatexDoc::on' was given in /var/www/wiki/includes/Hooks.php on line 119

Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'LatexDoc::on' was given in /var/www/wiki/includes/Hooks.php on line 119
MediaWiki internal error.

Original exception: exception 'MWException' with message 'Detected bug in an extension! Hook LatexDoc::on failed to return a value; should return true to continue hook processing or false to abort.' in /var/www/wiki/includes/Hooks.php:160
Stack trace:
#0 /var/www/wiki/includes/parser/Parser.php(324): wfRunHooks('ParserBeforeStr...', Array)
#1 /var/www/wiki/extensions/FlaggedRevs/FlaggedRevs.class.php(280): Parser->parse('<div style="fon...', Object(Title), Object(ParserOptions), true, true, 9401)
#2 /var/www/wiki/extensions/FlaggedRevs/FlaggedRevs.class.php(541): FlaggedRevs::parseStableText(Object(Article), '<div style="fon...', 9401)
#3 /var/www/wiki/extensions/FlaggedRevs/FlaggedArticle.php(315): FlaggedRevs::stableVersionIsSynced(Object(FlaggedRevision), Object(Article))
#4 /var/www/wiki/extensions/FlaggedRevs/FlaggedRevs.hooks.php(1097): FlaggedArticle->setPageContent(false, false)
#5 [internal function]: FlaggedRevsHooks::onArticleViewHeader(Object(Article), false, false)
#6 /var/www/wiki/includes/Hooks.php(119): call_user_func_array(Array, Array)
#7 /var/www/wiki/includes/Hooks.php(150): wfInvoke('FlaggedRevsHook...', Array)
#8 /var/www/wiki/includes/Article.php(815): wfRunHooks('ArticleViewHead...', Array)
#9 /var/www/wiki/includes/Wiki.php(440): Article->view()
#10 /var/www/wiki/includes/Wiki.php(59): MediaWiki->performAction(Object(OutputPage), Object(Article), Object(Title), Object(User), Object(WebRequest))
#11 /var/www/wiki/index.php(93): MediaWiki->initialize(Object(Title), Object(Article), Object(OutputPage), Object(User), Object(WebRequest))
#12 {main}

Exception caught inside exception handler: exception 'MWException' with message 'Detected bug in an extension! Hook LatexDoc::on failed to return a value; should return true to continue hook processing or false to abort.' in /var/www/wiki/includes/Hooks.php:160
Stack trace:
#0 /var/www/wiki/includes/parser/Parser.php(462): wfRunHooks('ParserBeforeStr...', Array)
#1 /var/www/wiki/includes/parser/Parser.php(3954): Parser->preprocess('$1 - {{SITENAME...', Object(Title), Object(ParserOptions))
#2 /var/www/wiki/includes/MessageCache.php(673): Parser->transformMsg('$1 - {{SITENAME...', Object(ParserOptions))
#3 /var/www/wiki/includes/GlobalFunctions.php(586): MessageCache->transform('$1 - {{SITENAME...')
#4 /var/www/wiki/includes/GlobalFunctions.php(549): wfMsgGetKey('pagetitle', true, false, true)
#5 /var/www/wiki/includes/GlobalFunctions.php(455): wfMsgReal('pagetitle', Array, true)
#6 /var/www/wiki/includes/OutputPage.php(324): wfMsg('pagetitle', 'Erreur interne')
#7 /var/www/wiki/includes/Exception.php(148): OutputPage->setPageTitle('Erreur interne')
#8 /var/www/wiki/includes/Exception.php(183): MWException->reportHTML()
#9 /var/www/wiki/includes/Exception.php(269): MWException->report()
#10 /var/www/wiki/includes/Exception.php(318): wfReportException(Object(MWException))
#11 [internal function]: wfExceptionHandler(Object(MWException))
#12 {main}
Comment 1 Roan Kattouw 2008-11-11 14:28:22 UTC
(In reply to comment #0)
> 'Detected bug in an
> extension! Hook LatexDoc::on failed to return a value; should return true to
> continue hook processing or false to abort.' 
Pretty obvious to me.
Comment 2 Bertrand GRONDIN 2008-11-11 14:46:56 UTC
I don't understand. Can you explain me
Comment 3 Charles Melbye 2008-11-11 14:49:19 UTC
The hook that the failing extension is trying to add is incorrect. It should return true, but it's not. Should be a fairly easy fix, I'm sure there will be a patch on here before I have a chance to get home and make one myself ;-)
Comment 4 Brad Jorsch 2008-11-11 14:49:44 UTC
I'm not so sure, it looks like it may be due to a recent modification to
includes/Hooks.php. r43377 factored out the guts of wfRunHooks into a separate
function. One of the several ways to specify a hook function is to pass an
object which has a method "onEventName" for the appropriate hook; it seems the
new function is trying to construct that "onEventName" at line 39 of Hooks.php,
but fails because $event isn't passed down to the new function from wfRunHooks.

In this case, LatexDoc would just be one extension that uses that method of
specifying the event handler.
Comment 5 Bertrand GRONDIN 2008-11-12 00:23:52 UTC
It seems that the problem is now in the LaTex Doc extension. After to have disabled it, the wiki seems running correctly.
Comment 6 Brad Jorsch 2008-11-12 14:03:03 UTC
More likely, none of your other modules specify hooks in that way. See [[mw:Manual:Hooks#Writing an event handler]] for all the different ways a module can specify an event handler function.
Comment 7 Brad Jorsch 2008-11-12 14:07:53 UTC
Created attachment 5522 [details]
Possible patch

This patch just adds an $event parameter to the new functions, so the event name may be passed down to where it is needed.
Comment 8 Brad Jorsch 2008-11-12 19:26:03 UTC
Marking fixed, Brion reverted r43377 in r43416.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links