Last modified: 2012-07-26 21:10:28 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 T13224, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 11224 - References are not shown to Anons when they don't have edit permissions
References are not shown to Anons when they don't have edit permissions
Status: RESOLVED WORKSFORME
Product: MediaWiki extensions
Classification: Unclassified
Cite (Other open bugs)
unspecified
All All
: Low normal with 2 votes (vote)
: ---
Assigned To: Nobody - You can work on this!
:
: 16767 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-09-07 08:33 UTC by Tarek
Modified: 2012-07-26 21:10 UTC (History)
13 users (show)

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


Attachments
Backtrace (340.27 KB, text/plain)
2008-06-16 14:11 UTC, Roan Kattouw
Details

Description Tarek 2007-09-07 08:33:44 UTC
When setting the edit permission for anonymous users to false they are not longer able to see the references, the <references/> tag just gives out a line break.
Comment 1 Huji 2007-09-07 11:14:27 UTC
I cannot reproduce the bug you mentioned. I restrict the edit permission and enable the Cite extensions with this code:

require_once("../extensions/Cite/Cite.php");
$wgGroupPermissions['*']['edit'] = false;

And it still shows the references for anonymous users on my local wiki.
Comment 2 Tarek 2007-09-19 07:24:38 UTC
It seems that it is the following combination which causes the problem:
$wgGroupPermissions['*']['edit'] = false;
$wgGroupPermissions['sysop']['edit'] = true;

Cite works fine when changing one of these two values from false to true or vice versa, but in this combination it does not show the references.
Comment 3 Huji 2007-09-19 13:30:05 UTC
Yes I confirm that bug. I traced the code and figured that on this function on Cite.php file:

function referencesFormat() {
  if ( count( $this->mRefs ) == 0 )
  ....

The condition of that IF is met, when viewing the page as anonymous, with the settings mentioned by Tarek above, while it goes to the "else" part, when logged in. The count of $this->mRefs depends on how they are populated in functino stack(); I added a line to the begining of the function as such:

function stack( $str, $key = null ) {
  if ( $key === null ) {
  // No key
  $this->mRefs[] = $str;
  echo count( $this->mRefs ); //ADDED LINE
  ...

It returned "12" when logged on, and "11" when anonymous. I played with the code more, understood that mInCnt is set to zero by clearState() function, so suspected that it is called incorrectly, for anonymous users. I commented the last line of setHooks() function temporarily:

function setHooks() {
  global $wgParser, $wgHooks;
			
  $wgParser->setHook( 'ref' , array( &$this, 'ref' ) );
  $wgParser->setHook( 'references' , array( &$this, 'references' ) );

  //$wgHooks['ParserClearState'][] = array( &$this, 'clearState' );
}

To stop the effect of clearState, and voila! It fixed the bug. Surely, it is not a solution, but I'm not yet good enough with MediaWiki code to track the problem more than this and propose a real solution. I thought sharing these would help other developers to fix it faster and sooner.
Comment 4 Lionel Brits 2007-12-13 22:12:40 UTC
I have the same problem, with the same combination of user rights. However, with identical versions of cite.php, the problem doesn't seem to occur on 1.9.3, while it occurs on 1.11.0
I don't know if this is relevant.
Comment 5 Roan Kattouw 2008-06-16 14:10:34 UTC
Fixed in r36333.

For some strange reason, the Parser decided to clearState() in mid-parse, clearing Cite's state too. I've worked around this by refusing to clear state if $this->mInCite is true, but there's probably a deeper problem. For those interested in further investigation, I've attached my backtrace.
Comment 6 Roan Kattouw 2008-06-16 14:11:10 UTC
Created attachment 4989 [details]
Backtrace
Comment 7 Terry A. Hurlbut 2008-07-21 15:08:17 UTC
Gentlemen:

I just noticed, on two sites that I administer, that Cite.php does not show references to anonymous users if anonymous users are blocked from editing, while registered users are allowed to edit. This has nothing to do with sysops being able to edit and everything to do with creating a user class with higher editing privileges.

The sites are:

<http://creationwiki.org/>
<http://www.conservapedia.com/>

Both of them use MediaWiki 1.12.0.

I realize that you thought you had that thing fixed. Just to make sure, I checked-out the latest version from the subversion "trunk." And still I couldn't get anonymous users to see the references. Specifically, when I log out of my sysop account, I cannot see the references, and the reference superscripts change to all 1's.
Comment 8 Jelte (WebBoy) 2008-08-11 19:02:45 UTC
Probably strongly related to bug 13841.
Comment 9 Jonathan 2008-12-06 16:31:41 UTC
I exactly the same problem but downloaded r44219 today and it solves it (previously I'd been using r36333). 

[The problem I had was that, while logged-in and sysop users could see citations properly, anon users could only see [1]'s and no <references> block.]
Comment 10 Svemir Brkic 2009-01-05 03:11:02 UTC
Running MediaWiki 1.13.3, non-logged-in users see the list of references correctly UNLESS there is a gallery tag BEFORE the final "references" tag on the page. Logged-in users always see the references correctly. Non-logged-in users see the list of references if there is no gallery tag on the page, or if the gallery is moved after that references tag. The problem seems to happen due to clearState being called before the list of references has been rendered.
Comment 11 Aaron Shafovaloff 2009-01-10 01:11:30 UTC
I'm running the latest SVN of both MediaWiki and Cite but I'm still having the same problem: anonymous users see the footnote numbering but not the list. Only when logged in can I see it.
Comment 12 Aaron Schulz 2009-09-12 19:13:23 UTC
(In reply to comment #10)
> Running MediaWiki 1.13.3, non-logged-in users see the list of references
> correctly UNLESS there is a gallery tag BEFORE the final "references" tag on
> the page. Logged-in users always see the references correctly. Non-logged-in
> users see the list of references if there is no gallery tag on the page, or if
> the gallery is moved after that references tag. The problem seems to happen due
> to clearState being called before the list of references has been rendered.

I can't reproduce this with 1.15+
Comment 13 Aaron Schulz 2009-09-12 19:15:58 UTC
*** Bug 16767 has been marked as a duplicate of this bug. ***
Comment 14 matanya 2012-07-26 21:10:28 UTC
Seems to be fixed on 1.15+

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


Navigation
Links