This reverts commit 9786c54e39.
Reason for revert: The function accepts both int and string.
If there were warnings for int, then silencing the warning would be
fair, but the PHP 8.1 deprecation warning is only for nulls, which are
are unsupported by makeKey() and would mask a likely source of genuine
mistakes.
Change-Id: I5c57d7721ed9ae51d617c2c125adb0bf8bf31f1d
This is really hard to read. What is code, what is string? These
places are so simple, they really don't need the "{$var}" syntax.
Change-Id: I589dedb8c0193eec4eef500bbb896b5b790b727b
When invalid JSON is being saved, change the error message from the
generic "invalid-content-data" to "invalid-json-data" with the specific
error passed as param.
Allow extensions to hook into JSON validation, enabling them to apply
additional validations for specific JSON files such as MediaWiki:*.json
config files. The page identity is passed to the hook.
Bug: T313254
Change-Id: If9590c29ed0b871b03a3db8f13e72ee9cfdd7e2b
This patch creates a patch to cover the aforementioned code path for
when it works correctly and when it throws.
Change-Id: I4b3d9f280a0977d3811afb768824da302673e659
By splitting the setOriginalData methods into several setters, we remove
any knowledge about the structure of the request body from HTMLTransform.
It also allows us to be specific about which data to operate on.
This also removes the concept of page bundles from the public interface
of HTMLTransform. PageBundle objects are used only internally.
Change-Id: If97a74ce251f281b7d980928a01b764d6ec0d0a4
The `$workCallback` passed from MediaWiki.php to LBFactory is an
optional callback that Rdbms may invoke whenever it expects to idle
for some time before waiting for something.
In practice, this never happens because the main reason it was
introduced was for use in ChronologyProtector, and it was removed from
there last year in commit bd7cf4dce9 (I0456f5d40a).
The code wrapping for it has remained in-place, because there was
still one theoretical caller in LBFactory for when Redis (or some
other ChronologyProtector store) is down.
I propose that if Redis is down, the fallback is that we let
replication happen normally, which we expect in most cases to suffice
by itself, since replication is generally faster than a full
server-client-server RTT. CP logs a warning when this happens, for
operational visibility.
In the past 90 days, there are exactly 2 entries in unsampled WMF
Logstash for `channel:DBReplication message:persistSessionReplicationPositions`
(not including labswiki/cloudweb which were having problems in this
timeframe, failing for related reasons).
Logs for the two matching reqId:
1. 2022-07-14 wikidata POST /w/api.php (referer: -)
> - MediumSpecificBagOStuff::doLock failed due to timeout for
> global:Wikimedia\Rdbms\ChronologyProtector:87f2d18…:v2.
> - …::persistSessionReplicationPositions: failed to save primary
positions for DB cluster(s) s8, cluster27
2. 2022-07-27 enwiki POST /w/index.php (referer: Special:CreateAccount)
> - MediumSpecificBagOStuff::doLock failed due to timeout for
> global:Wikimedia\Rdbms\ChronologyProtector:d19e340…:v2.
> - …::persistSessionReplicationPositions: failed to save primary
positions for DB cluster(s) extension2
Bug: T314434
Change-Id: Id60cf994c7a40c50b487e6281c6bd114ddf13690
Follow-up to f7158c396d.
When the page exists, we use a different code path, calling
TrivialLanguageConverter::convertSplitTitle() or
LanguageConverter::convertSplitTitle() to format the namespace,
which already does this.
Bug: T316092
Change-Id: I7ff29ab7cd0999e364ec5521cc2097cbe6f1ed3d
While working on the site notice in Vector we've noticed these
styles are proving more problematic than helpful so splitting these
up allows us more granularity in the styles we ship.
The core interface styles are now enabled by default as they contain
important logic relating to empty portlets and the print footer
Bug: T316027
Change-Id: Ib5ae640bb260cee46e654228b785c776722c7003
The third argument to VueComponentParser::element is null for
void elements. Trying to run preg_replace on a null string causes
a warning in php8.1. Add a check for null.
This fixes a unit failure test in php8.1:
RuntimeException: Error parsing file 'resources/skins.vector.search/App.vue'
in module 'skins.vector.search': preg_replace(): Passing null to parameter #3
($subject) of type array|string is deprecated
Bug: T313663
Change-Id: I6904b0279ecc7bada3f8203a165307c17e5ee795
Since (T208881) "CSS using var() to create exponential sized calc() on wiki page will crash visitor's browser" was fixed by disabling var in inline CSS, the issue with browser crashes appears to have been fixed in Firefox, Chrome, modern Edge, and Opera.
This change reverts T208881.
Bug: T288201
Change-Id: I387a0e9fdd02faa69616890c613462c83b91b789
PHP 8.1 changes the order of protected properties in the output
of serialize(). Previously they were at the end of the
serialized stream, now they are at the beginning.
Given that serialization formats have multiple equivalent encodings,
and there is no guarantee that they might not arbitrary change between
versions in backwards compatible ways, I think we should not do
byte for byte comparisons. Instead we should deserialize both
and compare the resulting objects for equality. This should test
what we want to know (That we can read serialized structures) well
also being safe against compatible format changes.
This fixes a number of failing ParserOutputTest::testSerialization
on php 8.1.
Bug: T313663
Change-Id: Ic7a08b436d65ab7492f343fa02281e245834aaea
I consider it busywork to maintain this, for no tangible benefit.
Limiting the credited coverage to a class is limiting enough to
exclude unintended coverage from reports. Especially as this
helps ensure tracking coverage correctly for implementation details
such as helper methods and internal methods that do not warrant
their own test as that would defeat the purpose of tests exercising
the contract and demonstrating good usage.
Change-Id: Icf865f15cbd86585bbc02fc4943a960efb40c0eb
This method is supposed to return a single message in array form
(['key', 'param1', ...]), as can be seen e.g. in includes/Block.php
in MediaWiki 1.31 of the includes/block classes in 1.34.
Allow for the key to be a Message object, which means passing the
array contents as a functions parameter list will work with most
message-related functions, is already used by the GlobalBlocking
extension, and allows more complex messages not possible with plain
arrays.
Change-Id: Ic19dc1dde25794f9bb3b3b5d8abba8ddf8948886