Page MenuHomePhabricator

Fatal error: Call to a member function getFullUrl() on a non-object in CentralAuthHooks.php on line 1106
Closed, DeclinedPublic

Description

in CentralAuthHooks, if $wiki in "$wiki = WikiMap::getWiki( wfWikiID() );" is null, then we get a fatal error.

I see such code elsewhere in the hooks file without checks for if $wiki is valid.

If configuration of $wgConf is not correct, then the $wiki can be null. The code should probably throw an exception and then have some graceful error handling.

Though not exactly sure what/how to handle the error, and I find it a bit unclear to understand what the hooks are trying to do.

Fatal error: Call to a member function getFullUrl() on a non-object in /Library/WebServer/Documents/php-master/extensions/CentralAuth/CentralAuthHooks.php on line 1106
Call Stack
# Time Memory Function Location
1 0.0007 652864 {main}( ) ../index.php:0
2 0.3577 18514840 MediaWiki->run( ) ../index.php:46
3 0.3578 18514840 MediaWiki->main( ) ../Wiki.php:447
4 0.7266 35420480 OutputPage->output( ) ../Wiki.php:598
5 0.7598 37910584 wfRunHooks( ) ../OutputPage.php:2083
6 0.7598 37910632 Hooks::run( ) ../GlobalFunctions.php:4009
7 0.7607 37912840 call_user_func_array:{/Library/WebServer/Documents/php-master/includes/Hooks.php:206} ( ) ../Hooks.php:206
8 0.7607 37913264 CentralAuthHooks::onBeforePageDisplay( ) ../Hooks.php:206


Version: master
Severity: normal

Details

Reference
bz63625

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 3:20 AM
bzimport set Reference to bz63625.
bzimport added a subscriber: Unknown Object (MLST).

Still happening today on REL1_39:

[f7ff732dd96f012305680f76] /index.php/Main_Page Error: Call to a member function getFullUrl() on null

Backtrace:

from /home/kizule.ga/icrc1.kizule.ga/extensions/CentralAuth/includes/CentralAuthHooks.php(685)
#0 /home/kizule.ga/icrc1.kizule.ga/extensions/CentralAuth/includes/Hooks/Handlers/PageDisplayHookHandler.php(119): MediaWiki\Extension\CentralAuth\CentralAuthHooks::getEdgeLoginHTML()
#1 /home/kizule.ga/icrc1.kizule.ga/includes/HookContainer/HookContainer.php(160): MediaWiki\Extension\CentralAuth\Hooks\Handlers\PageDisplayHookHandler->onBeforePageDisplay()
#2 /home/kizule.ga/icrc1.kizule.ga/includes/HookContainer/HookRunner.php(945): MediaWiki\HookContainer\HookContainer->run()
#3 /home/kizule.ga/icrc1.kizule.ga/includes/OutputPage.php(2871): MediaWiki\HookContainer\HookRunner->onBeforePageDisplay()
#4 /home/kizule.ga/icrc1.kizule.ga/includes/MediaWiki.php(922): OutputPage->output()
#5 /home/kizule.ga/icrc1.kizule.ga/includes/MediaWiki.php(562): MediaWiki->main()
#6 /home/kizule.ga/icrc1.kizule.ga/index.php(50): MediaWiki->run()
#7 /home/kizule.ga/icrc1.kizule.ga/index.php(46): wfIndexMain()
#8 {main}
taavi lowered the priority of this task from Medium to Lowest.Mar 19 2023, 11:00 AM
taavi subscribed.

Yeah, this is caused by a misconfigured $wgConf. I'm willing to accept patches to add a more clear error message, but I don't consider this a CentralAuth bug given the extension is not designed for general use.