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

       Web browser: ---
            Bug ID: 59644
           Summary: Flow: use text() or plain() instead of message parse()
                    where possible
           Product: MediaWiki extensions
           Version: master
          Hardware: All
                OS: All
            Status: NEW
          Keywords: performance
          Severity: normal
          Priority: Unprioritized
         Component: Flow
          Assignee: wikibugs-l@lists.wikimedia.org
          Reporter: sp...@wikimedia.org
                CC: ebernhard...@wikimedia.org, oke...@wikimedia.org,
                    pandiculat...@gmail.com, sp...@wikimedia.org
    Classification: Unclassified
   Mobile Platform: ---

While Flow changed anonymous IP handling, blank IP addresses led to topic
participants appearing in a white typewriter text block.  This happened because
wikitext parsing of a message starting with a blank results in pre-formatted
text.  In eval.php,
  echo wfMessage( 'flow-topic-participants', 2, 2, '', 'second person'
)->parse();
(note the empty string for first participant); this prints

<pre>and second person
</pre>

We fixed that bug, but it's wasted effort doing this level of wikitext parsing
if we don't need to, and it's prone to embarrassing HTML output. Niklas on
mediawiki-i18n list commented
  Is there any other wikitext besides the magic words? You could just use
->text() instead of ->parse().

and sure enough if you call text() instead you avoid the additional parsing.  I
didn't test this message's complex GENDER handling in a language where it
matters, but we should check all our messages using parse() (about 13 of them
in PHP) and see if we can switch them to ->text(), or escaped() if they're
directly output, or even plain(). See
https://www.mediawiki.org/wiki/Manual:Messages_API . Use of parse() where we
don't intend to be converting wikitext constructs into HTML seems about 25%
slower on this string in my dopey testing, and could cause some display bugs.

-- 
You are receiving this mail because:
You are the assignee for the bug.
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