wiki.techinc.nl/includes/parser/Hook
C. Scott Ananian b72fa830d6 Pass a ConvertibleTimestamp to CoreMagicVariables
This avoids a type mismatch found by phan strict checks
(Ifc7fc64ac26a756f181b7d0155f13a6500114f5e) -- the passed timestamp
from Parser was a string in unix format (ie, an integer as a string)
but was declared as an integer.  It was then passed to
MWTimestamp::getInstance() which expected a string.

However, the 'simple' fix for this issue still caused unnecessary
conversions to/from timestamp format.  We took the string (nominally
in TS_MW format), ran a regexp against it to convert it to an
MWTimestamp instance, then converted that MWTimestamp to UNIX format
and exported that as a string, just to take that string and run four
different regexps against it *again* to convert it back to an
MWTimestamp instance so we can format it.

Better to just pass the MWTimestamp directly.  Only two wrinkles:

1. the ParserGetVariableValueTs hook expects to be passed a string
in TS_UNIX format and then to be able to mutate it. Nothing in production
uses that hook, so only do this conversion if the hook is registered.

2. Parsoid would like to use the definitions in CoreMagicVariables
in the future as well.  So pass the timestamp as the not-MW-@internal
ConvertibleTimestamp class instead of directly as a MWTimestamp.

Change-Id: Ib2c5fa45630c54c2716897370a0580ed48d27242
2022-03-14 17:30:15 -04:00
..
AfterParserFetchFileAndTitleHook.php
BeforeParserFetchFileAndTitleHook.php
BeforeParserFetchTemplateAndtitleHook.php
BeforeParserFetchTemplateRevisionRecordHook.php
BeforeParserrenderImageGalleryHook.php
GetLinkColoursHook.php
InternalParseBeforeLinksHook.php
InternalParseBeforeSanitizeHook.php
IsValidEmailAddrHook.php
PageRenderingHashHook.php
ParserAfterParseHook.php
ParserAfterTidyHook.php
ParserBeforeInternalParseHook.php
ParserBeforePreprocessHook.php
ParserCacheSaveCompleteHook.php
ParserClearStateHook.php
ParserClonedHook.php
ParserFirstCallInitHook.php
ParserGetVariableValueSwitchHook.php
ParserGetVariableValueTsHook.php
ParserGetVariableValueVarCacheHook.php
ParserLimitReportFormatHook.php
ParserLimitReportPrepareHook.php
ParserMakeImageParamsHook.php
ParserModifyImageHTML.php
ParserOptionsRegisterHook.php
ParserOutputPostCacheTransformHook.php
ParserPreSaveTransformCompleteHook.php
ParserSectionCreateHook.php
RejectParserCacheValueHook.php