Page MenuHomePhabricator

inconsistent behavior if a property name includes a namespace
Closed, ResolvedPublic


Author: info

User reported on the mailing list

that two relations Rel1 and A:Rel1 on the same page collapse into one relation, "Rel1".

I was able to reproduce this by creating a property with the namespace "Help:" in its name.
[[Test relation::Sandbox2a]] [[MyPrefix:Test relation::Sandbox2b]] [[Help:Test relation::Sandbox2c]

The factbox lists the property "Test relation" with the values Sandbox2a and Sandbox2c. (The property name "MyPrefix: Test relation" has no problem because it's just a name with a colon in it.)

Expected results:
I'm not sure why the "Help" namespace vanished. But it seems insane to allow a property name to include a namespace name. So rather than show the confusing

Help:Test relation    sandbox2

in the factbox when the link actually goes to a property, it would be better to warn the user

Don't use namespace ("Help") in a property's name.

Version: unspecified
Severity: minor



Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 9:48 PM
bzimport set Reference to bz11059.

This is fixed now, though it is still not recommended to label properties like that. Anyway, similar problems are likely to occur again: the troble is that we often use MediaWiki's Title::newFromText to process user input. This method takes a namespace as a parameter, but this namespace is the default only, not an overwrite. So as long as titles have no namespaces, the default works as expected, but if title strings bring their own namespace, it overrides the default. The only workaround is to fetch the local label of a desired namespace and to prepend it manually.