wiki.techinc.nl/tests/phpunit/includes
Máté Szabó f15e0a62f9 ApiQueryRevisionsBase: Fix 'rvdiffto' parameter handling on PHP 8.0
The legacy 'rvdiffto' API parameter allows consumers to supply a
revision ID or the special strings 'cur', 'prev', 'next' to
revision-related API modules. This will then be resolved to a revision
and the diff of returned revisions against this revision will be
attached to the response.

On PHP 8.0, this parameter is broken as 'cur', 'prev', 'next' no longer
get resolved to the appropriate revision ID but rather are treated as
invalid literal revision IDs. This is because given an associative array
`$params = [ 'diffto' => 'prev' ];`, the expression `$params['diffto']
!= 0` is false on PHP < 8.0 but true on PHP >= 8.0.[1]

Fix it by also checking whether the parameter value is numeric before
treating it as a revision ID, and add a test case for this logic. To
facilitate testing, convert the counter used by ApiQueryRevisionsBase to
count the number of uncached diffs served in the current response to an
instance variable; it is currently a static variable which persists
across test boundaries.

Change-Id: Ifbe14cd2880c98dddc5577d226bef5878bdd657f

---
[1] https://onlinephp.io/c/81e7b

Bug: T322335
Change-Id: Id5032932842c94f4d3ca3707fbc733f5b9704151
2022-11-03 15:49:04 +01:00
..
actions Reorg: Move some of request related classes to MediaWiki/Request 2022-10-28 10:15:31 +00:00
api ApiQueryRevisionsBase: Fix 'rvdiffto' parameter handling on PHP 8.0 2022-11-03 15:49:04 +01:00
auth Reorg: Move some of request related classes to MediaWiki/Request 2022-10-28 10:15:31 +00:00
block Reorg: Move some of request related classes to MediaWiki/Request 2022-10-28 10:15:31 +00:00
cache objectcache: Remove WANObjectCacheReaper feature 2022-10-25 23:09:39 +01:00
changes tests: Upgrade PHPUnit from 8.5+ to 9.5+ 2022-10-08 02:03:55 +02:00
changetags Sort logging table by timestamp and log id 2022-10-09 14:19:34 +00:00
collation tests: Replace checkPHPExtension() with @requires annotations 2022-10-23 20:47:14 -04:00
config Use short array destructuring instead of list() 2022-10-21 15:33:37 +11:00
content Reorg: Move some of request related classes to MediaWiki/Request 2022-10-28 10:15:31 +00:00
context Reorg: Move some of request related classes to MediaWiki/Request 2022-10-28 10:15:31 +00:00
db rdbms: improve LoadBalancer connection pool reuse (ii) 2022-10-18 17:23:44 -07:00
debug Reorg: Move some of request related classes to MediaWiki/Request 2022-10-28 10:15:31 +00:00
deferred Use short array destructuring instead of list() 2022-10-21 15:33:37 +11:00
diff tests: Use MediaWikiIntegrationTestCase::editPage for edits 2022-09-23 22:49:59 +02:00
editpage tests: Migrate setMwGlobals() to overrideConfigValue(s) 2022-07-27 18:07:00 +01:00
exception tests: Migrate away from setMwGlobals() 2022-08-22 20:17:49 +00:00
externalstore Use ::class to refer to class names 2022-08-17 22:59:17 +02:00
filebackend lockmanager: remove MysqlLockManager and DBLockManager 2022-10-14 17:43:44 -07:00
filerepo Use short array destructuring instead of list() 2022-10-21 15:33:37 +11:00
GlobalFunctions Reorg: Move some of request related classes to MediaWiki/Request 2022-10-28 10:15:31 +00:00
HookContainer
htmlform Reorg: Move some of request related classes to MediaWiki/Request 2022-10-28 10:15:31 +00:00
http Migrate usage of setMwGlobals() to overrideConfigValue(s) 2022-08-01 06:16:22 +01:00
import tests: Avoid WikiPage in ImportableOldRevisionImporterTest 2022-10-17 20:43:11 +00:00
installer Replace trivial usa of mock builder with createMock() shortcut 2022-07-15 16:43:48 +00:00
interwiki Migrate usage of setMwGlobals() to overrideConfigValue(s) 2022-08-01 06:16:22 +01:00
jobqueue Revert "Reorg: Move some of request related classes to MediaWiki/Request" 2022-10-27 13:14:16 +00:00
language Migrate usage of setMwGlobals() to overrideConfigValue(s) 2022-08-01 06:16:22 +01:00
languages
libs tests: Use @requires annotation in APCUBagOStuffTest 2022-10-24 01:15:29 -04:00
linkeddata Reorg: Move some of request related classes to MediaWiki/Request 2022-10-28 10:15:31 +00:00
linker tests: Add missing @group Database 2022-08-06 22:55:12 +02:00
logging tests: Migrate MediaWiki settings to overrideConfig...() 2022-08-18 17:48:03 +01:00
mail tests: Add missing @group Database 2022-08-06 22:55:12 +02:00
media tests: Replace checkPHPExtension() with @requires annotations 2022-10-23 20:47:14 -04:00
Message
Navigation Introduce PagerNavigationBuilder for making pagination links 2022-09-05 16:10:36 -04:00
objectcache SqlBagOStuff: Fix modtoken comparison 2022-08-19 11:11:58 +10:00
page Reorg: Move some of request related classes to MediaWiki/Request 2022-10-28 10:15:31 +00:00
pager Reorg: Move some of request related classes to MediaWiki/Request 2022-10-28 10:15:31 +00:00
ParamValidator/TypeDef tests: Add missing @group Database 2022-08-06 22:55:12 +02:00
parser Use short array destructuring instead of list() 2022-10-21 15:33:37 +11:00
password
Permissions Reorg: Move some of request related classes to MediaWiki/Request 2022-10-28 10:15:31 +00:00
poolcounter Separate RevisionOutputCache::makeParserOutputKey from no revid case 2022-09-09 18:24:27 -07:00
preferences Reorg: Move some of request related classes to MediaWiki/Request 2022-10-28 10:15:31 +00:00
rcfeed Migrate from setMwGlobals() to overrideConfigValue(s) 2022-08-02 10:14:10 +01:00
registration
ResourceLoader Reorg: Move some of request related classes to MediaWiki/Request 2022-10-28 10:15:31 +00:00
Rest REST: introduce getPrivateRouteUrl 2022-07-14 13:12:35 +00:00
Revision tests: Replace deprecated WikiPage::factory in RevisionStoreDbTest 2022-11-01 13:30:14 +00:00
search Don't calculate size of thumb until requested 2022-10-25 13:42:38 +02:00
session Merge "Reorg: Move some of request related classes to MediaWiki/Request" 2022-10-31 23:10:30 +00:00
shell tests: Replace assertRegExp with assertMatchesRegularExpression 2022-10-07 14:13:16 -04:00
site Migrate use of global to use of config settings 2022-08-12 12:25:17 +00:00
skins Componentize menulink + footer 2022-09-28 14:57:37 +00:00
sparql Replace trivial usa of mock builder with createMock() shortcut 2022-07-15 16:43:48 +00:00
specialpage Reorg: Move some of request related classes to MediaWiki/Request 2022-10-28 10:15:31 +00:00
specials Reorg: Move some of request related classes to MediaWiki/Request 2022-10-28 10:15:31 +00:00
Storage tests: Replace checkPHPExtension() with @requires annotations 2022-10-23 20:47:14 -04:00
title tests: Migrate away from setMwGlobals() to overrideConfigValue(s)() 2022-08-14 22:23:25 +01:00
upload Reorg: Move some of request related classes to MediaWiki/Request 2022-10-28 10:15:31 +00:00
user Reorg: Move some of request related classes to MediaWiki/Request 2022-10-28 10:15:31 +00:00
utils Remove the deprecated MWGrants class 2022-09-16 17:07:20 +02:00
watcheditem phpunit: Avoid deprecated at() matcher 2022-10-06 18:57:24 -04:00
ActorMigrationTest.php Use short array destructuring instead of list() 2022-10-21 15:33:37 +11:00
ActorMigrationTest.sql
AutoLoaderTest.php tests: Use overrideConfigValue(s) where necessary 2022-07-16 23:45:52 +01:00
CategoryTest.php tests: Use Title::makeTitle instead of Title::newFromText 2022-09-23 21:53:11 +02:00
CommentStoreCommentTest.php
CommentStoreTest.php Use short array destructuring instead of list() 2022-10-21 15:33:37 +11:00
CommentStoreTest.sql
ContentSecurityPolicyTest.php [php8.1] Change override of $wgResourceBasePath for CSP tests 2022-07-25 12:54:04 -07:00
EditPageConstraintsTest.php Reorg: Move some of request related classes to MediaWiki/Request 2022-10-28 10:15:31 +00:00
EditPageTest.php Reorg: Move some of request related classes to MediaWiki/Request 2022-10-28 10:15:31 +00:00
ExportTest.php tests: Use overrideConfigValue(s) where necessary 2022-07-16 23:45:52 +01:00
ExtraParserTest.php tests: Use Title::makeTitle instead of Title::newFromText 2022-09-23 21:53:11 +02:00
FauxRequestTest.php Reorg: Move some of request related classes to MediaWiki/Request 2022-10-28 10:15:31 +00:00
GitInfoTest.php tests: Use overrideConfigValue(s) where necessary 2022-07-16 23:45:52 +01:00
HooksTest.php
HtmlTest.php tests: Use overrideConfigValue(s) where necessary 2022-07-16 23:45:52 +01:00
LinkerTest.php tests: Replace deprecated WikiPage::factory 2022-09-02 19:34:02 +00:00
LinkFilterTest.php Externallinks: Add ability to write to the new fields 2022-10-25 22:14:15 +02:00
MagicWordFactoryTest.php
MediaWikiServicesTest.php Use short array destructuring instead of list() 2022-10-21 15:33:37 +11:00
MediaWikiTest.php Revert "Reorg: Move some of request related classes to MediaWiki/Request" 2022-10-27 13:14:16 +00:00
MediaWikiVersionFetcherTest.php
MergeHistoryTest.php tests: Use Title::makeTitle instead of Title::newFromText 2022-09-23 21:53:11 +02:00
MessageTest.php tests: Use overrideConfigValue(s) where necessary 2022-07-16 23:45:52 +01:00
MockServiceWiring.php
MovePageTest.php tests: Use MediaWikiIntegrationTestCase::editPage for edits 2022-09-23 22:49:59 +02:00
MultiHttpClientTest.php Use short array destructuring instead of list() 2022-10-21 15:33:37 +11:00
MWTimestampTest.php tests: Use overrideConfigValue(s) where necessary 2022-07-16 23:45:52 +01:00
OutputPageTest.php Reorg: Move some of request related classes to MediaWiki/Request 2022-10-28 10:15:31 +00:00
PagePropsTest.php
SampleTest.php tests: Use Title::makeTitle instead of Title::newFromText 2022-09-23 21:53:11 +02:00
SiteStatsTest.php
StatusTest.php Use short array destructuring instead of list() 2022-10-21 15:33:37 +11:00
TemplateCategoriesTest.php tests: Use Title::makeTitle instead of Title::newFromText 2022-09-23 21:53:11 +02:00
TestUser.php tests/api: Add TestUser::getAuthority and use it 2022-08-06 23:15:27 +02:00
TestUserRegistry.php
TimeAdjustTest.php tests: Use overrideConfigValue(s) where necessary 2022-07-16 23:45:52 +01:00
TitleTest.php Use the null coalescing assignment operator 2022-10-21 13:26:49 +11:00
TitleUrlTest.php tests: Use overrideConfig(Value|Values) where needed 2022-07-12 22:24:50 +00:00
TrackingCategoriesTest.php
WebRequestTest.php Reorg: Move some of request related classes to MediaWiki/Request 2022-10-28 10:15:31 +00:00
WikiMapTest.php tests: Migrate MediaWiki settings to overrideConfig...() 2022-08-18 17:48:03 +01:00
XmlTest.php tests: don't assume wgLanguageCode is 'en' 2022-07-21 19:32:41 -04:00