Introduce Message::plaintextParam
authorErik Bernhardson <ebernhardson@wikimedia.org>
Wed, 17 Sep 2014 21:39:15 +0000 (14:39 -0700)
committerErik Bernhardson <ebernhardson@wikimedia.org>
Tue, 30 Sep 2014 19:51:29 +0000 (12:51 -0700)
commitd55fedfba8ce80c76dd86b9696cb72c4adb01255
tree0e5a2c011961deed7759e58c7befe60296b7e0cb
parent0755177e64facf9b2f7c7b0937e669e1a0ff4a7f
Introduce Message::plaintextParam

I have run into numerous issues trying to utilize unsafe user
provided content as an argument to a Message instance.  Specific
cases are enumerated in MessageTest.php

Typically the solution to using user provided text is to use
Message::rawParam, but this pushes escaping of the parameter to
the caller.  This patch introduces Message::plaintextParams which
handles escaping of the string parameter to match the requested
output format.

The functionality is:
* plain and text: exactly like rawParams()
* escaped, parse and parseAsBlock: escape it but don't do brace expansion

Additionaly, similar to Message::rawParam, plaintext parameters are not
valid parser function arguments.

Change-Id: I320645cd23c98fea4bfc32ab22b7ef8d320957cb
includes/Message.php
tests/phpunit/includes/MessageTest.php