Last modified: 2011-06-01 19:15:19 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 T31219, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 29219 - SMWSQLStore2::getPropertyValues() for a specific page requires that property name has underscores
SMWSQLStore2::getPropertyValues() for a specific page requires that property ...
Status: RESOLVED INVALID
Product: MediaWiki extensions
Classification: Unclassified
Semantic MediaWiki (Other open bugs)
unspecified
All All
: Unprioritized major (vote)
: ---
Assigned To: Markus Krötzsch
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-05-31 17:20 UTC by Yaron Koren
Modified: 2011-06-01 19:15 UTC (History)
1 user (show)

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


Attachments

Description Yaron Koren 2011-05-31 17:20:48 UTC
When SMWSQLStore2::getPropertyValues() is called for a specific page (i.e., with a non-null $subject), the $property argument has to have been created with a property name that has underscores instead of spaces, for the call to work; I assume that's a bug.

This can be fixed by adding the following line to the beginning of SMWSQLStore2::getSMWPageIDandSort():

$title = str_replace( ' ', '_', $title );

...but maybe there are better ways to solve it.
Comment 1 Markus Krötzsch 2011-06-01 16:24:34 UTC
This is not a bug. SMWDIProperty objects are initialized by a property "key". This key can have two forms: either it is the MediaWiki DBkey of a property page (for user-defined properties), or it is the key for a registered special property of SMW (a string starting with "_").

If you want to create SMWDIProperty objects from a user-provided label, or from a text that might be the (normalized) label of a special property (and you are not sure), then you should use the SMWDIProperty::newFromUserLabel(). Overall, you should always be able to generate a suitable SMWDIProperty for the store call in one line.

SMWDIProperty could implement additional checks to throw exception when the "key" has a space in it, but this would take additional time that we might rather want to safe there. General clean-up and "best effort" input interpretation on the other hand is not meant to happen in DI classes but in the according DVs. Using a DV is usually the best solution when user input is processed (with all its possible messiness, e.g. leading spaces).
Comment 2 Yaron Koren 2011-06-01 19:15:19 UTC
Okay, thanks for the clarification. I've switched the SF code to also use SMWDIWikiPage::newFromTitle() now, instead of "new SMWDIWikiPage()", for the same reason.

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


Navigation
Links