Last modified: 2012-01-24 07:14:25 UTC
Created attachment 9892 [details] Patch for SMW_Subobject.php Hi, Empty properties in Subobjects create an error saying that an Attribute value can't be empty. This use case can easily occur when declaring subobjects trough Forms/Templates since you would specify each property, which could end with an empty parameter value: {{#subobject:DeliveryAddress| In_Country=United States | In_State= New York}} {{#subobject:DeliveryAddress| In_Country=Luxembourg | In_State= }} The source code's comments in SMW_Subobject.php seem to indicate that properties with empty values were supposed to be correctly ignored, but testing the number of parameters got after a split on the "=" character is not enought since there will be 2 elements in the resulting array, the latter being an empty string. Quick patch joined. Mediawiki 1.17, Semantic Mediawiki 1.7
marking patch as "need-review"
I don't know if this is the correct way to solve the error you are getting. Can you post the error? Markus, probably best if you have a quick look at this.
This was not the originally intended behaviour of this function, but I can see that it is practically convenient to do this. It hides a certain kind of error but it the template would become unnecessarily complicated to test this. Fixed in r109905 as suggested in the patch. It might be worthwhile to consider if this behaviour should be the same for all property annotations in all input methods. Currently, empty values will still cause errors in many other situation, but I don't think that empty values are ever accepted (even empty strings are generally rejected by SMW, so nobody is using this yet).