Last modified: 2011-03-11 14:01:01 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
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
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.
Right ok. Can you confirm your suggested change fixes the issue?
This fixes it. Thanks for updating the code.
Awesome, thanks for pointing out the fix :)