[Mediawiki-l] Strange error that shouldn't theoretically happen

Brion Vibber brion at wikimedia.org
Fri Aug 28 05:11:25 UTC 2009


On 8/27/09 5:55 PM, Juliano F. Ravasi wrote:
> I'm the author of the Wikilog MediaWiki extension. Today, a user
> contacted me about an error that MediaWiki is reporting concerning the
> extension:
>
> 	Detected bug in an extension! Hook WikilogHooks::UnknownAction
> 	failed to return a value; should return true to continue hook
> 	processing or false to abort.
[snip]
> The error message seems really obvious, except that there should be no
> way for the reported function to finish without returning a value.

The callback is called via call_user_func_array, which apparently can 
end up returning null in certain failure cases:

http://bugs.php.net/bug.php?id=47554

You can see an example here where I try passing in an invalid callback 
(as I don't have the class locally, it's not callable):

 > var_dump(call_user_func(array('WikilogHooks','UnknownAction')));
Warning: call_user_func(WikilogHooks::UnknownAction): First argument is 
expected to be a valid callback in 
/Library/WebServer/Documents/trunk/maintenance/eval.php(60) : eval()'d 
code on line 1
NULL

That warning message may not be shown depending on PHP's error_log and 
display_errors settings, leaving only MediaWiki's display of the 
now-surprising exception about the hook function returning null.

There could be several reasons it's failing:

* something's trashing the $wgAutoloadClasses entries, causing the hooks 
class to not be loaded (I suspect this is most likely; another extension 
might be responsible)
* missing or damaged WikilogHooks.php file
* missing or damaged Wikilog.php file
* weird PHP breakage like a borked opcode cache

-- brion



More information about the MediaWiki-l mailing list