Page MenuHomePhabricator

mysterious error if module registration throws an exception
Closed, InvalidPublic

Description

If you leave out or misname the schema key when you register a schema module, you get an error on every page:

'jQuery is not defined' in http://localhost/wiki/load.php?debug=true&lang=en&modules=skins.vector&only=scripts&skin=vector&

without a stack trace, Neither jQuery nor mediaWiki is available to the page.

What happens is the first resource request

http://localhost/wiki/load.php?debug=true&lang=en&modules=startup&only=scripts&skin=vector&*

contains only JavaScript comments that report the PHP exception ( /* exception 'MWException' with message 'SchemaModule options must set a "schema" key.' ...) , and so the second RL request results in random errors.

To reproduce, add the module from EventLogging/examples/module-declaration.php but leave out or garble schema:

$wgResourceModules[ 'schema.Person' ] = array(
  'class'  => 'SchemaModule',
  'schemaOOPS' => 'Person',
);

Then load any page. ?debug=1 doesn't help identify the error.

I'm not sure how or whether to fix this, and it's probably a ResourceLoader issue rather than this particular extension. It's good that RL failures are reported in comments rather than messing up the page.

Anyway, I updated https://www.mediawiki.org/wiki/ResourceLoader/Developing_with_ResourceLoader#Debugging to say that PHP errors appear in comments.


Version: unspecified
Severity: minor

Details

Reference
bz42641

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 1:12 AM
bzimport set Reference to bz42641.

Related: bug 42166 "load.php should return HTTP 500 if one or more exceptions were thrown during the generation of the module response(s)".

It's a ResourceLoader issue; there is nothing specific to EventLogging about it. The same thing happens if, for example, a standard module declaration refers to a file that doesn't exist.

Back-end errors are logged by the back end.

[moving from MediaWiki extensions to Analytics product - see bug 61946]