Last modified: 2014-03-26 17:52:48 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 T38016, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 36016 - Two fields having a common part in the name result in a breakage of the definition and the autocomplete of the form
Two fields having a common part in the name result in a breakage of the defin...
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
SemanticForms (Other open bugs)
unspecified
All All
: Unprioritized normal (vote)
: ---
Assigned To: Yaron Koren
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-04-16 14:29 UTC by icarnevale
Modified: 2014-03-26 17:52 UTC (History)
2 users (show)

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


Attachments

Description icarnevale 2012-04-16 14:29:31 UTC
Given two wiki property pages called "Calls Service" and "Calls service version", both property are property of the instance page "Service", 
therefore used in "Template:Service" and "Form:Service" pages.

Here's the text of the Template Text.

Template text:
 {| class="wikitable"
 !Calls Service
 | {{#arraymap:{{{field_Calls Service|}}}|;|wk_template_var|[[Calls Service::wk_template_var]]}}
 |-
 !Calls service version
 | {{#arraymap:{{{field_Calls service version|}}}|;|wk_template_var|[[Calls service version::wk_template_var]]}}
 |-|}


Depending on the order of these fields definition in the template page, two different use cases occur:
1) If "Calls Service" preceeds "Calls service version", there are no problems, because the parsing function scans sequentially the template text for the first name page,
then for the second page name without hiccups.
2) If the order of field definitions are inverted with "Calls service version" before "Calls Service", the parsing function scans successfully the first page name, but
the second page name is obfuscated by the first one, and it is systematically ignored, since its character string is 'already' contained in the first one.

The technical reason resides in the function "handlePropertySettingInTemplate()" in "includes/SF_TemplateInForm.php":

 $cur_pos = stripos( $templateText, $fieldName );
 $templateFields[$cur_pos] = $templateField;

It searches the string position of the field name in the template text, placing the result in an array with the position as key.

A possible workaround solution is to restrict the search for the full fieldName until the '|' character:

 $cur_pos = stripos( $templateText, $fieldName.'|' );
 $templateFields[$cur_pos] = $templateField;
 
A better solution may involve a regexp.
Comment 1 Yaron Koren 2012-04-18 02:01:42 UTC
Thanks for the suggested fix - before I look into this, I should just note that, if SF every messes up on parsing the template, you can hardcode the relationship between the form input and the property by adding the "property=" parameter to the {{{field}}} tag. So while this bug (and similar ones) are annoying, I wouldn't put them at the level of "critical".
Comment 2 Yaron Koren 2012-06-22 00:07:11 UTC
Changing severity from "Critical" to "Normal", based on my comment.
Comment 3 Gerrit Notification Bot 2014-03-26 17:34:29 UTC
Change 121112 had a related patch set uploaded by Jatin:
Two fields having a common part in the name result in a breakage

https://gerrit.wikimedia.org/r/121112
Comment 4 Gerrit Notification Bot 2014-03-26 17:39:59 UTC
Change 121112 merged by jenkins-bot:
Two fields having a common part in the name result in a breakage

https://gerrit.wikimedia.org/r/121112
Comment 5 Yaron Koren 2014-03-26 17:44:00 UTC
This is now finally fixed, thanks to Jatin Mehta adding in the suggested patch. Sorry that it took two years to add in essentially a one-character fix. :(

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


Navigation
Links