wiki.techinc.nl/includes/parser
Brian Wolff bec8dada48 Clarify generate-html and make ParserOutput behave as expected
Previously:
* It was unclear that generate-html is an optional optimization
* Most of MediaWiki core was doing $parserOutput->setText('') if
html wasn't generated. However this is wrong and will cause
$parserOutput->hasText() to return true and also potentially cause
cache pollution if a content handler both does that and supports
parser cache (Like MassMessage; see T299896)
* The default value of mText in the constructor was '', and most
of the time MW used that default. This doesn't seem right. If
setText() is never called, the ParserOutput should not be considered
to have text
* It was impossible to set mText to null, as $parserOutput->setText(null)
was a no-op. Docs implied you were supposed to do this, so it was very
confusing.

This patch clarifies docs, changes the default value for ParserOutput::$mText
from '' to null, and makes $parserOutput->setText(null) do what you
expect it to. The last two are arguably breaking changes, although
the previous behaviours were unexpected, mostly undocumented and
based on a code search do not appear to be relied on.

It seems like the main reason this only broke MassMessage is most
content handlers either don't support generateHtml, or they don't
support parser cache.

Bug: T306591
Change-Id: I49cdf21411c6b02ac9a221a13393bebe17c7871e
Depends-On: I68ad491735b2df13951399312a4f9c37b63a08fa
2022-05-03 11:23:08 +02:00
..
Hook Create ParserFetchTemplateData hook 2022-03-28 17:25:34 -04:00
Parsoid Use MainConfigNames instead of string literals, #4 2022-04-26 19:03:37 +03:00
BlockLevelPass.php phan: Disable null_casts_as_any_type setting 2022-03-21 18:25:07 +00:00
CacheTime.php Use MainConfigNames instead of string literals, #4 2022-04-26 19:03:37 +03:00
CoreMagicVariables.php Use MainConfigNames instead of string literals, #4 2022-04-26 19:03:37 +03:00
CoreParserFunctions.php Use MainConfigNames instead of string literals, #4 2022-04-26 19:03:37 +03:00
CoreTagHooks.php Use MainConfigNames instead of string literals, #4 2022-04-26 19:03:37 +03:00
DateFormatter.php phan: Remove PhanTypePossiblyInvalidDimOffset suppression 2022-03-28 23:26:49 +02:00
DateFormatterFactory.php
LinkHolderArray.php Use MainConfigNames instead of string literals, #4 2022-04-26 19:03:37 +03:00
MWTidy.php
Parser.php Use UrlUtils in Parser 2022-04-28 17:14:51 +03:00
ParserCache.php phan: Disable null_casts_as_any_type setting 2022-03-21 18:25:07 +00:00
ParserCacheFactory.php Use MainConfigNames instead of string literals, #4 2022-04-26 19:03:37 +03:00
ParserCacheMetadata.php
ParserFactory.php Use UrlUtils in Parser 2022-04-28 17:14:51 +03:00
ParserObserver.php Detect and monitor against multiple Parser invocation during edit requests 2021-09-23 16:12:40 -05:00
ParserOptions.php Use MainConfigNames instead of string literals, #4 2022-04-26 19:03:37 +03:00
ParserOutput.php Clarify generate-html and make ParserOutput behave as expected 2022-05-03 11:23:08 +02:00
ParserOutputFlags.php Ensure that ToC is converted into the proper target language 2022-03-09 00:08:57 -05:00
PPCustomFrame_Hash.php
PPDPart_Hash.php
PPDStack_Hash.php
PPDStackElement_Hash.php
PPFrame.php
PPFrame_Hash.php parser: Fix various scalar types to match documentation 2022-03-14 20:20:06 +00:00
PPNode.php
PPNode_Hash_Array.php Using @return never documentation on always-throw-function 2021-09-07 17:29:03 +02:00
PPNode_Hash_Attr.php PHP 8.1: add ENT_COMPAT to some htmlspecialchars() calls 2022-01-25 16:30:44 +11:00
PPNode_Hash_Text.php PHP 8.1: add ENT_COMPAT to some htmlspecialchars() calls 2022-01-25 16:30:44 +11:00
PPNode_Hash_Tree.php PHP 8.1: add ENT_COMPAT to some htmlspecialchars() calls 2022-01-25 16:30:44 +11:00
PPTemplateFrame_Hash.php
Preprocessor.php phan: Disable null_casts_as_any_type setting 2022-03-21 18:25:07 +00:00
Preprocessor_Hash.php Use str_starts_with/str_ends_with 2022-05-02 10:59:58 +03:00
RemexRemoveTagHandler.php Add Sanitizer::removeSomeTags() which uses Remex to tokenize 2022-03-04 14:06:02 -05:00
RemexStripTagHandler.php Add Sanitizer::removeSomeTags() which uses Remex to tokenize 2022-03-04 14:06:02 -05:00
RevisionOutputCache.php Clarify debug message 2022-03-25 23:23:51 +01:00
Sanitizer.php Use str_starts_with/str_ends_with 2022-05-02 10:59:58 +03:00
StripState.php parser: Fix various scalar types to match documentation 2022-03-14 20:20:06 +00:00