This follows-up from T388924: PHP Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated which masked a PHP 8.1 warning about bad input being passed between Parser internals (it seems a string somewhere is turning into a null, but isn't meant to be. Once this is fixed, we should probably revert that in favour of native typehints).
That same request actualy emitted two production errors, one of which is a fatal error that affects PHP 7.4 and PHP 8.1 both, and remains reproducible today even with the deprecation warning resolved.
https://ca.wikipedia.org/w/index.php?title=Difracció&action=info
From T388924:
PHP Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated at MediaWiki\Parser\MagicWord->matchStartAndRemove(null) at … at MediaWiki\Message\Message->parseText(string) at MediaWiki\Message\Message->__toString() at InfoAction->onView()
RuntimeException: PCRE failure at MediaWiki\Parser\Parser->handleExternalLinks(string) at … at MediaWiki\Message\Message->__toString() at InfoAction->onView()
The same stack trace is the same as these tasks:
- T351953: Various old revisions are encoded as Windows-1252 rather than UTF-8, causing "RuntimeException: PCRE failure" when viewing them
- T387680: Old deletion log on Chinese Wikiquote is corrupt: RuntimeException: PCRE failure
- T387677: Truncated old revision on Bulgarian Wikipedia causing "RuntimeException: PCRE failure"
- T387675: RuntimeException: PCRE failure on English Wikiquote

