Last modified: 2012-09-27 01:10:59 UTC
Hello, I have some problem with the Vector skin when I use the 'userCan' hook to prevent some category of users from reading some talk pages. Output is : :Fatal error: Call to a member function isCurrent() on a non-object in .../skins/Vector.php on line 143 I tried to trace the problem trough the files of MediaWiki. In index.php, there is a call $mediaWiki->performRequestForTitle to init everything, including $wgArticle which is null at this point. In includes/Wiki.php * MediaWiki::performRequestForTitle : we do the preliminaryChecks * MediaWiki::preliminaryChecks : if user can't read, do the final cleanup ($wgArticle is still null) * MediaWiki::finalCleanup : output the page ($wgArticle is still null) ...a long list of function calls here... At line 143 of Vector.php : :if ( ( $isTalk && $wgArticle->isCurrent() ) || ( $wgOut->showNewSectionLink() ) ) { We assume that $wgArticle is not null. I think that adding a condition "isset($wgArticle)" would solve the problem.
The code of Vector has been deeply modified for 3 weeks. It seems that the problem doesn't exists anymore, but I can't reinstall MediaWiki now to do the testing. A simple test on the new version, like putting those lines in LocalSettings.php : :$wgHooks['userCan'][] = 'fnMyHook'; :function fnMyHook( &$title, &$user, $action, &$result ) :{ $result = false; return true; } And trying to read a talk page would probably give the answer...
(In reply to comment #1) > The code of Vector has been deeply modified for 3 weeks. It seems that the > problem doesn't exists anymore, but I can't reinstall MediaWiki now to do the > testing. > A simple test on the new version, like putting those lines in LocalSettings.php > : > :$wgHooks['userCan'][] = 'fnMyHook'; > :function fnMyHook( &$title, &$user, $action, &$result ) > :{ $result = false; return true; } > And trying to read a talk page would probably give the answer... Can't reproduce using that code on trunk (1.19) or 1.17. Closing worksforme.