aboutsummaryrefslogtreecommitdiffstats
path: root/.phan
Commit message (Collapse)AuthorAgeFilesLines
* objectcache: Remove $wgMainWANCache and $wgWANObjectCachesTimo Tijhof2023-03-071-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We always wrap the local cluster cache, and there are no subclasses of WANObjectCache. It was never documented or recommended how these would be used. It is a left-over from the original 2015 Multi-DC plan in which WANObjectCache would work differently. See task for details. Note that this requires no configuration changes, even in the theoretical case of these variables being used, as the only option is to use the main cache, and that's also the default. * Update WAN overrides to override the underlying main cache instead. * Fix EditPageTest which was previously implicitly using a 'hash' as main cache but also relying on wan cache to be 'none'. The part that it actually needs is the 'none'. When WAN cache is enabled, testUpdateNoMinor fails due to an edit conflict because one of the edits it makes is made with a current timestamp whereas it expects to simulate wpEdittime in the year 2012 which, when caching is enabled, is ignored and becomes the current time instead. I don't understand exactly why, but I'm going to conserve that behaviour for now. * Fix TemplateCategoriesTest, which was failing due to an unexpected cache hit: > [objectcache] fetchOrRegenerate(…:page:10:…): volatile hit This could be solved in a more realistic way by splitting the test, or by explicitly resetting services half-way the test to clear WikiPageFactory, PageStore and WANCache process state. For now, keep the prior behaviour of no cache in this test. Bug: T305093 Bug: T329680 Depends-On: If890622eed0d0f8b4bd73d36ba1815a3d760ea05 Depends-On: Ie1def75208822bdf19bb2cfd7e6edf32c2000e6b Depends-On: I35cce61dc3ee90dcee3dd6f0b36f84133be029ed Change-Id: I53781a8c06ebb2583f6ca83dd91bbfe8a5c88b13
* Reorg: Namespace the Title classJames D. Forrester2023-03-021-0/+1
| | | | | | | | | | | | | | | | | | | This is moderately messy. Process was principally: * xargs rg --files-with-matches '^use Title;' | grep 'php$' | \ xargs -P 1 -n 1 sed -i -z 's/use Title;/use MediaWiki\\Title\\Title;/1' * rg --files-without-match 'MediaWiki\\Title\\Title;' . | grep 'php$' | \ xargs rg --files-with-matches 'Title\b' | \ xargs -P 1 -n 1 sed -i -z 's/\nuse /\nuse MediaWiki\\Title\\Title;\nuse /1' * composer fix Then manual fix-ups for a few files that don't have any use statements. Bug: T166010 Follows-Up: Ia5d8cb759dc3bc9e9bbe217d0fb109e2f8c4101a Change-Id: If8fc9d0d95fc1a114021e282a706fc3e7da3524b
* TempFSFile: Use a WeakMap for reference tracking if availableMáté Szabó2023-02-122-0/+25
| | | | | | | | | | | | | Use a WeakMap to track references to TempFSFile instances if available to avoid deprecation warnings for dynamic property creation on PHP 8.2. Use an anonymous class rather than an stdClass to test the behavior in TempFSFileTestTrait to verify that bind() does not trigger dynamic property creation on PHP 8.2. Also add a Phan stub for WeakMap for PHP 7.4. Bug: T324894 Change-Id: Ic413c115e9ed1c750e175152094f3309628e777a
* build: Add phan stub for ReturnTypeWillChangeUmherirrender2022-12-162-0/+7
| | | | | | | ReturnTypeWillChange is new in php8.1 Allow to run phan under php80 with a stub Change-Id: Ib84b314bf495634583b625ed8d7530908286e839
* phan: Don't analyze .inc files, we don't use them nowKevin Israel2022-12-041-9/+0
| | | | | | | | | Also remove two vendor/* entries from exclude_file_list; besides the fact that one is a .inc file, both are part of dev dependencies, which are ignored after 3253cbf8d5e1826f. Bug: T184782 Change-Id: I0e0fac176b1c085e106533bcf3e8e3dcc75cd65a
* profiler: Drop support for Tideways 4.x in ProfilerXhprofKevin Israel2022-11-283-29/+16
| | | | | | | | | | | | | This branch fails to compile against PHP 7.4.3, our lowest supported version, and will not be updated to support that or any newer version: https://tideways.com/profiler/blog/releasing-new-tideways-xhprof-extension In doing so, remove the Xhprof class. At this point, it doesn't do anything other than calling either of two functions from whichever extension is installed, which can just be done in ProfilerXhprof. Change-Id: Iba1c16f47c68b36982f5d2dcda3bdf4dcb83501d
* phan: Remove internal stubs that should never be usedKevin Israel2022-11-254-1288/+0
| | | | | | | | | * dom: This PHP extension is an installation requirement so should always be available. * oci8: Oracle support was removed in 1.34 (4d10bb14e81aadb9). * sqlsrv: Likewise for Microsoft SQL Server. Change-Id: Id53f4ce477a19cff0063d3d60a405647249e7202
* phan: Remove ValueError stubKevin Israel2022-11-252-7/+0
| | | | | | | | | The only reference to ValueError (added in a80631ea0ca8ad6a) was removed in 47241a3520d5b4bf. Regardless, the stub is redundant to the one that is part of the symfony/polyfill-php80 library, which is already listed in composer.json as a required dependency. Change-Id: Ic9aa3e36d24bf79fb21ab37dd177e28f8176f573
* UserMailer: Don't check if PEAR Mail and Mail_mime classes existKevin Israel2022-11-252-95/+0
| | | | | | | | | | Since ee5a9b788a2fa3d9, pear/mail and pear/mail_mime are installed by Composer along with the other required external libraries, so these classes should exist in all installations. Also removed the Phan stub for the same reason. Change-Id: I6e545bf9fab15a66d1ea7bdf697908e7b1066897
* password: Update Argon2Password for PHP 7.4 minimumTim Starling2022-11-222-11/+0
| | | | | | | | | | | | | In PHP 7.4, it's possible to compile password without Argon, but if Argon is compiled in, both algorithms should be available. So: * Remove Phan stubs * Simplify class code * Add test per todo Change-Id: I749d456ad59698e5b1538b127586ea796efba1d1
* Phan: parse only directly required composer dependenciesTim Starling2022-11-101-2/+42
| | | | | | | | | | | | | | | | | | | Indirect dependencies are typically needed only by the direct dependencies, which are not analyzed. Dev dependencies are needed to run Phan, but are not needed in the code Phan is analyzing. So it turns out to be fairly straightforward to eliminate unnecessary dependencies from the Phan parse stage, reducing memory usage by about 40% and time usage by about 20%. This means I can run Phan on my laptop without first closing PHPStorm, which is convenient. As a matter of policy, you could argue that the list of allowed indirect dependencies here should be explicitly declared by moving them to composer.json. Change-Id: I987c3b22bafd1b4332fdeaf40ec3e20d35a3d929
* Respond to some messages from Phan on PHP 8.1Tim Starling2022-11-033-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * ForkController, OrderedStreamingForkController: indeed pcntl_fork() can't return false. * RL\Image: Specify type instead of using suppression, since the issue name changes. * VueComponentParser: Accept complaint about nullable nodeValue. * Disable PHP 8.0 polyfill stubs when running on PHP 8.0+ to avoid duplicate interface errors. * Add Socket stub and use it in LegacyHandler instead of multiple existing suppressions. * MemcachedPeclBagOStuff: accept complaint recommending !$result over $result === false when the type is boolean. * MemcachedPeclBagOStuff: fix probable bug, ignoring errors from Memcached::getMulti(). Phan noticed that $res=false was unreachable, but it should probably be reachable. * DatabaseMysqli: accept complaint that $this->conn->errno is already known to be an int. It was probably a hack for some previous version of Phan. * BcryptPassword, MWOldPassword, MWSaltedPassword: accept complaint that the !is_string() checks are unnecessary, after code review of PHP. * Pbkdf2PasswordUsingHashExtension: note that contrary to Phan's suggestion, this check is necessary. * DefaultPreferencesFactory: remove an existing hack for array_diff_key(), no longer necessary on 7.4 and causes an error on 8.1. Use coalesce instead of cast for the remaining array_intersect_key() hack since it better shows that we are casting away null. * FullSearchResultWidget: fix likely bug involving strict comparison between a float and an int. * SpecialWatchlist: accept complaint that $selectedHours is unconditionally a float, being the return value of round(), and thus the cast is unnecessary. * Add stub for AllowDynamicProperties, resolving an error in User.php. * Xml: accept complaint that $encMonth is already known to be an int. Six errors remain. These need suppressions or otherwise conflict with PHP 7.4 support. Bug: T322278 Change-Id: Ie375bbc8ccf22330b9a169e8da98f2bbe26ec8b9
* Revert "Reorg: Move some of request related classes to MediaWiki/Request"Zabe2022-10-271-1/+0
| | | | | | | | | This reverts commit 2bdc0b2b7209441a42a784157633a8a01b321922. Reason for revert: T166010#8349431 Bug: T166010 Change-Id: Idcd3025647aec99532f5d69b9c1718c531761283
* Reorg: Move some of request related classes to MediaWiki/RequestAmir Sarabadani2022-10-261-0/+1
| | | | | | | | | | | | | Moving: - DerivativeRequest - FauxRequest - FauxRequestUpload - PathRouter - WebRequest - WebRequestUpload Bug: T166010 Change-Id: I5ea70120d745f2876ae31d039f3f8a51e49e9ad8
* phan: Remove local override of suppress_issue_typesKevin Israel2022-10-211-7/+0
| | | | | | | | This is not needed after ef8c6b086e2c9399 in mediawiki/tools/phan, and the "approximate error count" in the comment is out of date after 43a93d9782bee485. Change-Id: I9c6749c981140227296e592f857f095bfb4ed29f
* .phan/config.php: Update minimum_target_php_versionReedy2022-10-031-3/+10
| | | | | | | Temporarily disable PhanPluginDuplicateExpressionAssignmentOperation Bug: T319186 Change-Id: I8ae3f74f482b5de3dd74471c2e853386d1fe1091
* Drop support for doctrine/dbal < 3.0.0Amir Sarabadani2022-09-291-12/+0
| | | | | | | Removes various hacks and back compat support Bug: T270740 Change-Id: I17d74705cdd5a2e1af0bda66bfa466067b8387a8
* Suppress php 7.4 phan false positiveZabe2022-09-191-0/+12
| | | | | | | | | | | | | | | see T298571 This failure only shows up for php 7.4 since that is using dbal 3.x.x while php 7.2 is using dbal 2.x.x Phan analysis is being disabled for those files for php 7.2 since those are now failing with 'unused suppression' and php 7.2 support is going to be dropped in the near future, so that doesn't matter to much. Bug: T316518 Change-Id: I74da37dc4329a7dd2c015a9d1fc7037a866f40c9
* tests/parser: Run phanUmherirrender2022-06-021-0/+6
| | | | | | | | | Run phan over classes in tests/parser The dependency of classes between parser and phpunit is not clear. Classes used by both possible needs part of /common/ Change-Id: I2ceca6b7cd447876c127ed3b14e09f479defbd93
* Docs: remove references to DefaultSettings.phpdaniel2022-05-301-3/+4
| | | | | Bug: T300129 Change-Id: I1e83a0dde6235bed91d28d7d43691c6a5d979f2f
* Turn DefaultSettings.php into a deprecated stubdaniel2022-05-171-0/+2
| | | | | | | | | | | DefaultSettings.php has been replaced by MainConfigSchema. Loading DefaultSettings.php is deprecated. Code that needs to have access to configuration defaults should use the ConfigSchema service object. Bug: T300129 Change-Id: I7b2c0ca95a78990be1cdb9dd9ace92f6dcf1af15
* phan: Add internal stub Redis::SERIALIZER_IGBINARYSébastien Beyou2022-04-181-0/+2
| | | | | Bug: T282133 Change-Id: I31f52d26bc022c77e50db42ac80c7dbe1a37c8e6
* phan: Remove PhanCompatibleAccessMethodOnTraitDefinition suppressionUmherirrender2022-03-311-3/+0
| | | | | | | | | | * Remove the fallback code in ImagePage, it is possible to call getImageLimitsFromOption non-statically in this situation * In OutputPage replace the call to trait function to one class implementing the trait Bug: T289813 Change-Id: I166a53615fb2be6e3d8b48489ce342e48435dfc3
* phan: Remove PhanPossiblyUndeclaredVariable suppressionUmherirrender2022-03-301-1/+0
| | | | | | | | | Make phan stricter about conditional variable declaration Remaining false positive issues are suppressed. The suppression and the setting change can only be done together Bug: T259172 Change-Id: I1f200ac37df7448453688bf464a8250c97313e5d
* Merge "phan: Upgrade mediawiki-phan-config to 0.11.1 and set ↵jenkins-bot2022-03-291-0/+5
|\ | | | | | | minimum_target_php_version"
| * phan: Upgrade mediawiki-phan-config to 0.11.1 and set minimum_target_php_versionJames D. Forrester2022-03-291-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MediaWiki still supports PHP 7.2+, but we want to mainly test in newer versions of PHP. Setting minimum_target_php_version to 7.2 this lets us run phan without phan trying to get us to make PHP 7.2-incompatible changes to 'appease' PHP 8.0 or whatever later changes. Some switches of generic 'resource' type-hinting to 'resource|object' to inform phan to ignore this (triggering PHPCS at the time, ah well), rather than trying to hint the specific novel PHP encapsulation classes to that have replaced them from PHP 8.0 onwards but don't yet exist, and fixes from where we were checking the results of implode and explode. Bug: T293924 Change-Id: I629e3fb3adfad73beb3d424a07e643c2e079d9bb
* | phan: Remove PhanTypePossiblyInvalidDimOffset suppressionUmherirrender2022-03-281-1/+0
|/ | | | | | | | | | | Make phan stricter about array keys Remaining false positive issues are suppressed. The suppression and the setting change can only be done together Bug: T304887 Depends-On: I3105a5fd4826f8667b5232834defc5ec93be32a1 Depends-On: Ie9610a6e83731468311edb3ed17f80fc509de385 Change-Id: I701f12ab94478c3b8e7fd82110ade74a8e6b04ef
* phan: Disable null_casts_as_any_type settingUmherirrender2022-03-211-1/+0
| | | | | | | | | | | Make phan stricter about null types by setting null_casts_as_any_type to false (the default in mediawiki-phan-config) Remaining false positive issues are suppressed. The suppression and the setting change can only be done together Bug: T242536 Bug: T301991 Change-Id: I0f295382b96fb3be8037a01c10487d9d591e7e01
* phan: Disable scalar_implicit_cast settingUmherirrender2022-03-181-2/+1
| | | | | | | | | Make phan stricter about scalar types by setting scalar_implicit_cast to false (the default in mediawiki-phan-config) Bug: T242536 Bug: T301991 Change-Id: Ia2fe30b17804186571722e728578121c8b75d455
* Using @return never documentation on always-throw-functionUmherirrender2021-09-071-3/+0
| | | | | | | | | | This helps phan to detect unreachable code and also impossible types after the functions. It helps phan to avoid false positives for array keys when the keys are checked before Bug: T240141 Change-Id: I895f70e82b3053a46cd44135b15437e6f82a07b2
* build: Update mediawiki/mediawiki-phan-config to 0.11.0Umherirrender2021-09-071-2/+3
| | | | | | | Addition and remove of suppression needs to be done with the version update. Change-Id: I3288b3cefa744b507eadebb67b8ab08c86517c1c
* build: Enable phan plugin UseReturnValuePluginUmherirrender2021-08-261-0/+3
| | | | | | | Suppress false positives Bug: T240141 Change-Id: Ie356512ad76de465b1fda5b913fa30702339cb11
* Bump wikimedia/remex-html to 2.3.2 and drop 2.3.1C. Scott Ananian2021-08-081-2/+1
| | | | | | | | | | | | | This is a bug fix release of RemexHtml, required by the latest version of Parsoid. RemexHtml migrated to a new namespace in 2.3.2. Since we don't support aliases in our phan configuration in core, update all uses to the new namespace to satisfy phan. Depends-On: I30f01f4a2a5479bb82c9b952ffa68a478215828a Depends-On: Iedf446635ee2112cfe637d8ebcf8092f0976bd17 Change-Id: I74fc929e4a66b28bfb1800ff0cd751c86e4a9f50
* Allow core to use remex-html 2.3.2C. Scott Ananian2021-08-081-1/+2
| | | | | | | | | | | | | | | | This is a bug fix release of RemexHtml, required by the latest version of Parsoid. RemexHtml migrated to a new namespace in 2.3.2 and uses aliases for compatibility. Once we upgrade mediawiki-vendor we can rename all the uses in core and turn off aliases again. Due to T287419, we need to suppress some phan issues because phan ends up running against both remex 2.3.1 *and* 2.3.2 in different CI jobs. These suppressions are removed in the follow up I74fc929e4a66b28bfb1800ff0cd751c86e4a9f50. Change-Id: I42edd4fb8cd277ea20e331994fcbe56b52bf3f06
* build: Upgrade php-parallel-lint from 1.2.0 to 1.3.0James D. Forrester2021-06-291-0/+2
| | | | Change-Id: Ibdf7a8935c194b00139b7ff0a2f32c3b58f06e10
* Exclude includes/PHPVersionCheck.php from phan scanningReedy2021-03-291-0/+3
| | | | | Subset cherry pick of a patch from REL1_35 Change-Id: Ic179ae51e9508e4af8c1fe57b78daa6102534faa
* build: Enable SecurityCheck-DoubleEscaped and suppress issuesUmherirrender2020-12-301-2/+0
| | | | | | | | | | | | This issue type was globally suppressed in I849ac4f120fd15b483e8939d4db45c98dc351259 to make reviewer easier. This adds inline suppressions or @suppress directives on function docs for false positives, mostly restoring those removed in I849ac4f120fd15b483e8939d4db45c98dc351259 Bug: T231311 Change-Id: I1b1d814bd907e9d49fcc39f777982936574fc7c6
* build: Enable phan-taint-check-plugin and suppress issuesUmherirrender2020-12-301-1/+2
| | | | | | | | | | | | | | | | | | Taint check checks for possible security issues by tracking html escaping and more by using phan. This slows done the phan-job a bit and requires more ram Keep the DoubleEscaped issues out to make reviewer easier Adds suppression for false positives Adds taint-annotation to help taint-check Removes suppression for code phan now understand better by the tracking of keys in taint-check Fix some small issues by adding int cast or htmlspecialchars calls Bug: T216348 Bug: T268920 Change-Id: I849ac4f120fd15b483e8939d4db45c98dc351259
* Remove ext-intl phan stubsReedy2020-11-292-1792/+0
| | | | | Bug: T267669 Change-Id: I5832db55c53b663e846044a2202be8403c8542ea
* Local config override file for PhanTim Starling2020-11-041-0/+5
| | | | | | | | Support a local (uncommitted) override file for Phan config. This is mostly so that I can exclude various broken things, rather than making a whole new clean source tree just for Phan. Change-Id: Icc66d8ae2b0029aabf57a57479c54cef05c747b9
* phan: Enable redundant_condition_detectionUmherirrender2020-07-011-5/+0
| | | | | | | | Remove duplicate casts Suppress false positives Bug: T248438 Change-Id: I2f89664a4bcd3b39b15e7cf850adda2f0c90ae6f
* phan: Conditionally load PHP extension stubs with dedicated optionDaimona Eaytoy2020-06-083-2/+2
| | | | | | | | Stubs for PHP extensions like wikidiff2 or excimer can be conditionally loaded using autoload_internal_extension_signatures, which is basically a wrapper around extension_loaded. Change-Id: I3e844427733339283c41fa9f4aeb23a776c36ce6
* Merge "Upgrade phan to 0.10.2"jenkins-bot2020-04-161-0/+1
|\
| * Upgrade phan to 0.10.2Daimona Eaytoy2020-04-161-0/+1
| | | | | | | | | | | | | | | | | | | | | | Amongst other things, this version of phan bundles taint-check, which is however disabled in the config file because there are lots of issues to be fixed. Upgrading phan alone now means that we can have a clean baseline for the taint-check upgrade. Bug: T248630 Change-Id: I8ab7ef9a9e73952098664176aad6c2b3b88095ee
* | Pbkdf2Password: Fix error handling on PHP 8Máté Szabó2020-04-072-0/+7
|/ | | | | | | | | | | | | With PHP 8, the hash_pbkdf2 function raises a ValueError when invoked with an unknown algorithm, as opposed to its previous behavior where it would raise an E_WARNING and return a non-string value. This patch updates the Pbkdf2Password class to handle this exception and re-throw it as our PasswordError exception. It also adds a Phan stub for the ValueError exception if it is not defined to avoid superfluous analysis errors. Bug: T248925 Change-Id: I7e0ec4e95598af27fee8282c7e53bca5378e506a
* Fix conditional phan config for ExcimerTim Starling2020-02-251-1/+1
| | | | | | | | | | ProfilerExcimer is a MW core class. This code was meant to detect the extension (which defines ExcimerProfiler not ProfilerExcimer) and if it is not present, to use the stubs. This is finding 01 of the wps.de review. Change-Id: I76b417859b99bafd92a8b8a4b361f8e3cef0100a
* build: Upgrade mediawiki-phan-config to 0.9.2Daimona Eaytoy2020-02-211-2/+2
| | | | | Bug: T244633 Change-Id: If8f35eaf3f2272717d7f12b4068d811b1a23d540
* phan: Upgrade redis stubs to 5.1.1Daimona Eaytoy2020-02-071-387/+444
| | | | | Bug: T239736 Change-Id: I40c3d5e8f98c1f391efdb4430f229793f1c84eb1
* Upgrade phan to 0.9.1Daimona Eaytoy2020-01-251-0/+1
| | | | | | | | | | Released just now. Many old suppressions can now be removed. Enabling the issue for undeclared variables is left to do later, given that there are roughly 200 warning. Change-Id: I99462a1e9232d6e75022912e2df82bc2038476ef
* build: Upgrade phan to 0.9.0Daimona Eaytoy2019-12-071-0/+5
| | | | | | | | | | | | | | | Scalar casts are still allowed (for now), because there's a huge amount of false positives. Ditto for invalid array offsets. Thoughts about the rest: luckily, many false positives with array offsets have gone. Moreover, since *Internal issues are suppressed in the base config, we can remove inline suppressions. Unfortunately, there are a couple of new issues about array additions with only false positives, because apparently they don't take branches into account. Change-Id: I5a3913c6e762f77bfdae55051a395fae95d1f841