Author: icarnevale
Description:
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:
- 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.
- 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.
Version: unspecified
Severity: normal