Last modified: 2011-07-15 16:52:05 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 T31760, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 29760 - Autoloader regression causes errors of "undefined function" after upgrading to 1.17
Autoloader regression causes errors of "undefined function" after upgrading t...
Status: RESOLVED INVALID
Product: MediaWiki
Classification: Unclassified
Search (Other open bugs)
1.17.x
All All
: Highest normal (vote)
: ---
Assigned To: Nobody - You can work on this!
: code-update-regression
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-07-07 18:16 UTC by Dan Barrett
Modified: 2011-07-15 16:52 UTC (History)
2 users (show)

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


Attachments

Description Dan Barrett 2011-07-07 18:16:21 UTC
In my LocalSettings.php, I have the following line to modify $wgMWSuggestTemplate to increase the number of dropdown items:

$wgMWSuggestTemplate = SearchEngine::getMWSuggestTemplate() . '&limit=20';

This works perfectly in MediaWiki 1.16.4 and earlier. In 1.17.0, however, when I run maintenance/update.php, the above line causes this error to be thrown, aborting update.php:

PHP Fatal error:  Call to undefined function wfScript()
in /.../includes/search/SearchEngine.php on line 457
Comment 1 Dan Barrett 2011-07-07 18:17:16 UTC
Line 457 in SearchEngine.php is:

return $wgServer . wfScript( 'api' ) . '?action=opensearch&search={searchTerms}&namespace={namespaces}&suggest';
Comment 2 Dan Barrett 2011-07-07 18:24:57 UTC
Looks like the same error is thrown by the web site, not only when running update.php.

Adding this line to LocalSettings.php fixes the problem, but should it be necessary?

require_once( "includes/GlobalFunctions.php" );
Comment 3 Sam Reed (reedy) 2011-07-07 18:58:03 UTC
It's a change in the order of the AutoLoader running, with respect to the settings also.

I'm not sure if this was was "supposed" to work, or was incidental
Comment 4 Chad H. 2011-07-08 19:39:59 UTC
I believe it was an accident that it worked. Moving it to $wgExtensionFunctions should do the trick.
Comment 5 Brion Vibber 2011-07-08 20:31:25 UTC
Never try to call MediaWiki active code from LocalSettings.php main area -- *all* MW functions and classes should be assumed unsafe to use.

If you need to call into MediaWiki *after* basic platform initialization, use $wgExtensionFunctions to add a callback that runs at that time.
Comment 6 Dan Barrett 2011-07-08 20:57:37 UTC
Brion: even static methods are considered unsafe? They are by nature designed to be called without initialization from their class.
Comment 7 Sam Reed (reedy) 2011-07-08 20:58:23 UTC
The classes aren't in scope (ie haven't been loaded) so aren't accessible
Comment 8 Dan Barrett 2011-07-15 16:52:05 UTC
Thanks. After trial and error, I rewrote our code to set $wgMWSuggestTemplate via the hook "SetupAfterCache".  This seems to be the only hook early enough to change $wgMWSuggestTemplate in time.

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


Navigation
Links