Last modified: 2012-09-27 01:10:59 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 T31547, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 29547 - talk page and $wgArticle=null
talk page and $wgArticle=null
Status: RESOLVED WORKSFORME
Product: MediaWiki
Classification: Unclassified
Interface (Other open bugs)
unspecified
All All
: Unprioritized minor (vote)
: ---
Assigned To: Trevor Parscal
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-06-23 13:10 UTC by ju.ju2004
Modified: 2012-09-27 01:10 UTC (History)
3 users (show)

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


Attachments

Description ju.ju2004 2011-06-23 13:10:09 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.
Comment 1 ju.ju2004 2011-06-24 07:58:10 UTC
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...
Comment 2 Bawolff (Brian Wolff) 2011-06-24 17:24:09 UTC
(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.

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


Navigation
Links