https://bugzilla.wikimedia.org/show_bug.cgi?id=36016

       Web browser: ---
             Bug #: 36016
           Summary: Two fields having a common part in the name result in
                    a breakage of the definition and the autocomplete of
                    the form
           Product: MediaWiki extensions
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: UNCONFIRMED
          Severity: critical
          Priority: Unprioritized
         Component: SemanticForms
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]
    Classification: Unclassified
   Mobile Platform: ---


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.

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to