Page MenuHomePhabricator

Namespaces does not resolved for languages with variants
Closed, DeclinedPublic

Description

Author: alefzet

Description:
After installing current MW 1.8-svn on localhost with config for multi-variant languages ('kk' or 'sr',
and probably 'zh'), links to pages in namespaces other of {{ns:0}} does not work (still in red).
English canonical names resolved only. I guess it is because improperly handled instructions for
conversion to lowercase letters. Is it valid?


Version: 1.8.x
Severity: normal

Details

Reference
bz7491

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 9:27 PM
bzimport set Reference to bz7491.
bzimport added a subscriber: Unknown Object (MLST).

Do you *guess* this because you *tested* it or did you *guess* it *randomly*?

Please provide some examples, and details of your configuration.
Is PHP's mbstring extension installed or not?

alefzet wrote:

(In reply to comment #1)

Do you *guess* this because you *tested* it or did you *guess* it *randomly*?

It is *guess* only. It isn't tested.

Please provide some examples, and details of your configuration.Is PHP's mbstring extension

installed or not?
Yes, it is PHP5 with some built-in extensions like iconv, mbstring etc. And ran under Windows XP

Links appear to work just fine with sr. Resolving WORKSFORME.
If problems continue, please:

  1. Ensure you have updated everything -- many files were moved in the last day.
  2. Provide *exact* examples of links which should work and *exact* descriptions of how they

fail.

  1. Provide details of configuration to go with these examples.

alefzet wrote:

httpd.conf

Apache 1.3.33 (Windows)

attachment httpd.conf ignored as obsolete

alefzet wrote:

php.ini

PHP 5.1.4.4 enabled as module for Apache

attachment php.ini ignored as obsolete

alefzet wrote:

LocalSettings.php

MW 1.8alpha (r16781) from SVN. Always is synchronised with svn, only
LanguagesXx.php and MessagesXx.php files for Kazakh variants is my own. Without
any cache managers.

attachment LocalSettings.php ignored as obsolete

alefzet wrote:

my.ini

MySQL 4.1.19

attachment my.ini ignored as obsolete

alefzet wrote:

If I remove localised $namespaceNames or change to English canonical names, everything works.
If apply localised $namespaceNames, all links out main namespace (ns:0) is red.
If I remove LanguageXx.php and MessagesXx.php files for Kazakh (or Serbian) variants and use only
one LanguageXx.php and MessagesXx.php (eg MessagesKk_kz.php to MessagesKk.php with exact content)
everything works as expected.
Yes, I know live sr wiki works normally. The trouble is with svn files. May be all svn version files
not yet installed on live sr wiki?

alefzet wrote:

(In reply to comment #8)

If I remove localised $namespaceNames or change to English canonical names, everything works.If

It is for default variant (kk-kz or sr-ec), changes for slave variants (kk-cn, kk-tr or sr-el)
haven't effect.

alefzet wrote:

One test: I change in $namespaceNames to NS_SPECIAL => 'Speçial' (change letter 'c' to 'ç') result
red links. Appears all non-English letters ignored in namespaces.

You still provide no examples of links that would fail.

Please provide this most basic of information!
You MUST provide exact steps to reproduce the problem!

alefzet wrote:

(In reply to comment #11)

You still provide no examples of links that would fail.Please provide this most basic of

information!You MUST provide exact steps to reproduce the problem!

Finally I got solution
In Language.php currently is a function getNsIndex:

function getNsIndex( $text ) {

		$this->load();
		$index = @$this->mNamespaceIds[$this->lc($text)];
		if ( is_null( $index ) ) {
			return false;
		} else {
			return $index;
		}

}

I revert this code to 1.6.7 version:

 	function getNsIndex( $text ) {
		$ns = $this->getNamespaces();

		foreach ( $ns as $index => $name ) {
			if ( strcasecmp( $name, $text ) == 0)
				return $index;
		}
		return false;

}

Immediately everything works fine.

jimmy.collins wrote:

Please post patches as attachmanet in unified format (diff -u) - makes it much
easier to handle them. Thanks!

alefzet wrote:

Patch for Language.php

attachment report.txt ignored as obsolete

  1. THERE IS STILL NO EXAMPLE OF WHAT FAILS.

THIS MEANS WE CANNOT VERIFY THE PROBLEM OR
TEST A FIX.

NOTHING WILL HAPPEN SINCE YOU CANNOT PROVIDE
THIS.

RESOLVING AS WORKSFORME.

  1. The given patch looks like it would certainly

fail for non-ASCII chars in most circumstances,
since it *removes* code which tries to do the
case-insensitive compare in a compatible way,
reverting it to a strcasecmp which will usually
fail for non-ASCII chars.

alefzet wrote:

  1. *all* links out main namespace (ns:0) is *red*

if you install wiki selecting 'sr' as default, click for example to 'Посебне странице' on sidebar or
http://localhost/wiki/%D0%9F%D0%BE%D1%81%D0%B5%D0%B1%D0%BD%D0%BE:Specialpages on address bar in
browser. Tell me what will happen, just me look message 'Тренутно нема текста на овој страници.
Можете претражити овај назив у осталим страницама или уредити ову страницу.' what is
message 'noarticletext'

  1. strcasecmp works as expected for non-ASCII chars

array mNamespaceIds with non-ASCII string as key, always is *empty*, than is_null( $index ) always
is NULL

  1. Cannot reproduce. These links are not red, and they do work. Посебно:Specialpages

and Посебно:Recentchanges work as expected.

  1. Please provide steps to reproduce.

alefzet wrote:

After reinstalling PHP I notice what the bug reproduced contineously in php 5.1.2 win32 only. In
current 5.1.6 works as expected. If You will *exactly* reproduce my configuration (see above) You
will see what happens.

Please check with 1.8.2, I suspect you'll find that the issue is resolved.
This looks like the same as bug 7562.

alefzet wrote:

I already had 1.9.
Yes, I think too this is the same as 7562.
I notice Title.php updated one day ago, than may be it is not PHP itself. But you may troubles with
function lc() for turkic letter pairs İi and Iı (dotted and undotted uppercase/lowercase).
It should have rezult

lc('İ') -> i and lc('I') -> ı

See also comments for [[bug 4379]]