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

           Summary: [PATCH] Undefined behavior for #arramap on empty
                    separator
           Product: MediaWiki extensions
           Version: any
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: minor
          Priority: Normal
         Component: SemanticForms
        AssignedTo: yaro...@gmail.com
        ReportedBy: cburg...@ira.uka.de
                CC: wikibugs-l@lists.wikimedia.org


Created an attachment (id=7529)
 --> (https://bugzilla.wikimedia.org/attachment.cgi?id=7529)
Patch solving the bug by implementing described solution

Parser extension function #arraymap allows for the specification of a user
defined separator. If an empty separator is passed with for example
{{#arraymap:12345||x|[[x]]}} it is directly passed on to explode() which yields
a warning on the resulting HTML page.

While the current implementation doesn't offer a defined result for this case,
I believe a meaning could be attached to it solving this issue.

There is currently no way to apply #arraymap to a list of characters without a
separator, e.g. for separating the digits in the example above. For this use
case #arraymap should break around the "empty" space between the digits. This
motivates my solution of using separator='' to yield a list of single
characters for a given string. The attached patch implements this behavior.

-- 
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
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to