Last modified: 2011-03-11 14:01:01 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 T29991, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 27991 - getTripleList in SMWExpData creates blank nodes for values of 0. Possible fix included
getTripleList in SMWExpData creates blank nodes for values of 0. Possible fix...
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
Semantic MediaWiki (Other open bugs)
unspecified
All All
: Normal normal (vote)
: ---
Assigned To: Markus Krötzsch
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-03-11 12:44 UTC by Chris Davis
Modified: 2011-03-11 14:01 UTC (History)
1 user (show)

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


Attachments

Description Chris Davis 2011-03-11 12:44:19 UTC
I've been debugging an issue where literal object values of zero are converted into blank nodes.  The particular property for this object has units associated with it, although I doubt that this contributes to the bug.

I believe that the problem is in the check for blank nodes in the getTripleList function in SMW_Exp_Data.php.  If I understand things correctly, then this line:
if ( ( $name == '' ) || ( $name[0] == '_' ) ) {

should be changed to this:
if ( ( $name === '' ) || ( $name[0] === '_' ) ) {

...so that it does not interpret 0 as an empty string.

Chris
Comment 1 Jeroen De Dauw 2011-03-11 12:55:52 UTC
I did not replicate the setup, nor do I understand why $name would ever be 0 (as int or float), but I applied the suggested fix as I don't see how it could break intended behavior: https://secure.wikimedia.org/wikipedia/mediawiki/wiki/Special:Code/MediaWiki/83694
Comment 2 Chris Davis 2011-03-11 13:26:06 UTC
I've found that $name can be 0 since in the code the name of the literal is just set to the value of the literal.  In other words, in debugging this I've also seen floats, dates, coordinates, etc used as values for $name.
Comment 3 Jeroen De Dauw 2011-03-11 13:37:12 UTC
Right ok. Can you confirm your suggested change fixes the issue?
Comment 4 Chris Davis 2011-03-11 13:48:11 UTC
This fixes it.  Thanks for updating the code.
Comment 5 Jeroen De Dauw 2011-03-11 14:01:01 UTC
Awesome, thanks for pointing out the fix :)

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


Navigation
Links