Last modified: 2012-01-24 07:14:25 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 T35901, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 33901 - Empty properties not ignored in subobjects
Empty properties not ignored in subobjects
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
Semantic MediaWiki (Other open bugs)
unspecified
All All
: Unprioritized normal (vote)
: ---
Assigned To: Nobody - You can work on this!
: patch, patch-need-review
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-01-23 11:39 UTC by LY Meng
Modified: 2012-01-24 07:14 UTC (History)
3 users (show)

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


Attachments
Patch for SMW_Subobject.php (499 bytes, patch)
2012-01-23 11:39 UTC, LY Meng
Details

Description LY Meng 2012-01-23 11:39:13 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
Comment 1 Sumana Harihareswara 2012-01-23 21:22:09 UTC
marking patch as "need-review"
Comment 2 Jeroen De Dauw 2012-01-23 21:35:19 UTC
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.
Comment 3 Markus Krötzsch 2012-01-24 07:14:25 UTC
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).

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


Navigation
Links