Last modified: 2012-08-17 18:45:30 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 T41403, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 39403 - Title::getSubpages() ignores $wgCapitalLinks
Title::getSubpages() ignores $wgCapitalLinks
Status: RESOLVED INVALID
Product: MediaWiki
Classification: Unclassified
General/Unknown (Other open bugs)
1.20.x
All All
: Unprioritized normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-08-15 23:25 UTC by Daniel A. R. Werner
Modified: 2012-08-17 18:45 UTC (History)
1 user (show)

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


Attachments

Description Daniel A. R. Werner 2012-08-15 23:25:19 UTC
Title::getSubpages() does not consider whether the first letter of the Title is capitalized or not (also see Title::getUserCaseDBKey()) in case $wgCapitalLinks is set to false.
If $wgCapitalLinks is false and the given title was created from a non-capitalized string, only subpages starting with a non-capitalized string should be returned I guess.

Or am I getting the concept of $wgCapitalLinks and how non-capitalized titles are handled wrong somehow?
Comment 1 Bawolff (Brian Wolff) 2012-08-16 18:06:17 UTC
>If $wgCapitalLinks is false and the given title was created from a
>non-capitalized string, only subpages starting with a non-capitalized string
>should be returned I guess.

Yes. Is that not the case?

The code in question:

2724                 $dbr = wfGetDB( DB_SLAVE );
2725                 $conds['page_namespace'] = $this->getNamespace();
2726                 $conds[] = 'page_title ' . $dbr->buildLike( $this->getDBkey() . '/', $dbr->anyString() );

getDBkey will return the title name with the first letter lowercase in the situation you describe above.

Title::getUserCaseDBKey() is a really useless function that I'm not sure what the point of is. It will only differ from Title::getDBkey() in the case that $wgCapitalLinks is set to true.
Comment 2 Bawolff (Brian Wolff) 2012-08-16 18:06:48 UTC
I'm setting this bug worksforme. I didn't actually test though, so feel free to re-open
Comment 3 Daniel A. R. Werner 2012-08-17 16:04:06 UTC
getDBkey() is using $mDbkeyform, which is capitalized, while $mUserCaseDBKey seems to be the only internal which holds the non-capitalized version.

Debugging this to test my "Subpage Fun" extension right now and I set $wgCapitalLinks=false for the test (which works fine). There could be an issue there, but I don't think so.

The real issue might be here:

3083    $this->mUserCaseDBKey = $dbkey;
3084    if ( $this->mInterwiki == '' ) {
3085        $dbkey = self::capitalize( $dbkey, $this->mNamespace );
3086    }
...
3110    $this->mDbkeyform = $dbkey;

It seems like the Title class ignores almost everything about $mUserCaseDBKey, it capitalizes the first letter in all functions but getUserCaseDBKey().
Comment 4 Bawolff (Brian Wolff) 2012-08-17 16:07:15 UTC
>getDBkey() is using $mDbkeyform, which is capitalized

Only if $wgCapitalLinks is set to true. if $wgCapitalLinks is set to false, then getDBkey() is uncapatalized because Title::capitalize is a no-op in that case.

See Title::capitalize
Comment 5 Daniel A. R. Werner 2012-08-17 17:03:38 UTC
You are right Bawolff, in the meanwhile I figured that as well. There is something wrong elsewhere, might have to do with the parser test system after all. I'll report again later.
Comment 6 Daniel A. R. Werner 2012-08-17 18:45:30 UTC
Alright, I think I put the pieces together and figured out the problem I am having.

Has to do with the parser tests setup for articles. All articles are created with upper-case letters, the $wgCapitalLinks is temporarily overwritten during ParserTest::addArticle().

See Bug 39461 where I explain this issue in detail.

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


Navigation
Links