| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This is a direct follow up to Id0e4b0d from 2019 where these
"constants" have been introduced. I believe the reason for using
protected properties was that we still had to support PHP 7.0 back
then, but class constants can only be marked as protected since
PHP 7.1.
According to codesearch these are apparently meant to be internal
to the filebackend classes in core and not used anywhere else.
Change-Id: I55683e3540f8d76324370efecb98d08e07547c28
|
|\ \ |
|
| |/
| |
| |
| |
| |
| |
| | |
… and make a few generic array type hints more specific, where
possible.
Change-Id: I1d0a89a9f10f0438f3bdd21d4067b0de69881c56
|
|\ \ |
|
| |/
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
array[]|bool[]|null[] means: It's either an array of arrays, an array
that contains only bools, or an array where all values are null. But
this is not what's happening here, as far as I can tell.
This minor fixup is motivated by T348688, but doesn't solve it.
However, now it's more obvious that the values that trigger the
reported error are "null", i.e. some instance of self::$RES_ERROR.
Bug: T348688
Change-Id: Ia9debe97d21a3abff7bff75f16a94bec8be6ddc5
|
|/
|
|
| |
Change-Id: I2771157a31aa6ee2b24fbd957c2c1ec0a0d9bdfc
|
|
|
|
|
|
| |
Similiar to what happen on cache delete failure
Change-Id: I9a29b73850ca99f3e333f7b733dcafedf7a2773b
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Put 100 bytes of the body into the log message to possible see more
information about the gateway error message
See T328872#8757648
Bug: T328872
Change-Id: I8b2df6d318d8de912eb9b992051b209bab236f37
|
|/
|
|
|
| |
Bug: T321882
Change-Id: I48c10343295c4eb3d9ef8037343b0070e928f040
|
|
|
|
|
|
|
|
|
| |
Avoid calling next() or count() when the buffer is null.
This avoids the risk of type errors.
Also improve some comments.
Change-Id: Ida422f4b7f185ac8bffc479ab5c82711e5621c89
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Use str_starts_with, str_ends_with or string offset where appropriate.
This fixes a bug in MimeAnalyzer where the "UTF-16LE" header could not
be identified because of wrong constant. This is the exact type of bug
that the new functions can avoid.
Change-Id: I9f30881e7e895f011db29cf5dcbe43bc4f341062
|
|/
|
|
|
|
| |
Since 208ebda there are never nulls in the array
Change-Id: I8299777689a6fb16c719ebf3c2bbc454255c0a37
|
|
|
|
|
|
| |
Collapse conditions when other types of the return value already checked
Change-Id: Iff7273495a58c8505b5f3aaf132964bdde2a63bb
|
|
|
|
|
|
|
|
|
|
|
| |
FileBackend::getLocalReference and FileBackend::getLocalCopy should
report failure and missing with different values to make error reporting
for the caller easier (FileBackendStore::doConcatenate in this case).
The existing subclass implementation for
FileBackendStore::doGetLocalCopyMulti already doing that.
Change-Id: Ie29aed48dc33bcd9fe1ed1e91685596044dfd988
|
|
|
|
|
|
|
|
| |
When trying to purge thumbnails, currently it tries to purge from the
main backend only leading to unhappiness
Bug: T331138
Change-Id: I2b13912296df68b2833b8c7c0bfe17d4ba362fce
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If you store a WeakMap in the object, containing only circular
references in the values, then nothing is keeping the WeakMap alive and
it can be deleted along with its parent TempFSFile by the garbage
collector.
A WeakMap contains normal references to its values, so those normal
references can be marked by the GC like any other references.
Instead, store the WeakMap as a static property.
Bug: T332461
Bug: T332397
Change-Id: Idbaa1019c2bac3d1dd9b001753c2f4c0aaf66e98
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
Dead code found by phan
Change-Id: I9fc404d546a4fb1c61394cb6359eb774fd94383a
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
When using the copyFileBackend script to copy from an fs based backend to a
swift backend, I'm getting "Undefined index: latest".
Fix this by using `!empty( $stat['latest'] )`, which checks if the index
is set.
Change-Id: I7b8331b9537483f7674030985a217210b39626c5
|
| |
| |
| |
| |
| |
| | |
New feature from PHP 7.4
Change-Id: Ifa7a9bc7b2ec415ad7ecb23f4c1776f51f58fd6b
|
| |
| |
| |
| | |
Change-Id: Iac27cb4aa936cb494b3e491ce22c88c7fad375a1
|
|/
|
|
|
|
|
|
| |
* Use @phan-var to suppress issues with version independence.
* In Parser strictly compare to false. I still think this is a Phan bug.
Bug: T322278
Change-Id: I654b73e5ed843474ed35c3780d95b04dce388bea
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| | |
Introduced in PHP 7.1. Because it's shorter and looks nice.
I used regex replacement.
Change-Id: I0555e199d126cd44501f859cb4589f8bd49694da
|
|/
|
|
|
|
|
|
| |
Available since PHP 7.4.
Automated search, manual replacement.
Change-Id: Ibb163141526e799bff08cfeb4037b52144bb39fa
|
|
|
|
| |
Change-Id: I8d4f6f0580748391abadcf096e6d0da45a1c390e
|
|
|
|
|
|
|
| |
Various variables are left from ealier refactor are now unused
and can be removed to make the code easier to read
Change-Id: Id51770af1f08e85c7e7a02234a2cd2ab5b47ee7a
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Follows I3ea6fb26296f (MySQLPlatformTest):
* Avoid uncertainty and make the code improvable/removable by explaining
what the suppression is for.
* Remove use of outdated AtEase, which hasn't been used in core tests
for several months (ref phpcs.xml), and more generally not in new code
in core or extensions (ref T253461).
Follows I12c17e327628 (FileBackendTest):
* I was going to similarly explain the reason by stating from the linked
task that it is for preg_match, and I was goingn to move the wholesale
suppression to just the getMockForAbstractClass() call that constructs
the FileBackend and thus triggers the issue.
* Instead, I've fixed the constructor to not pass a string there in the first
place as all non-string values are naturally invalid. Even if there is
a way to satisfy the regex with a non-string value that casts to a
valid string, that'd be an invalid value for a FileBackend name as it
pubicly documented as requiring a string, and internally also stored
and typed as assumed to be (after validation) a string.
* Change the valid test cases to be more representative of actually
intended-to-be-valid input, and actually-likely-attempted-but-invalid
input. The regex permits `[a-zA-Z0-9-_]` yet no numbers, capitals
or dashes were validated by the test, and no special characters
rejected by the test.
This follows If29780653 (c250d07bac) from 2019 which added these test
cases to improve code coverage without input from any (admitedly,
non-existent) active maintainers.
Bug: T313663
Change-Id: Ia326e17231a53c7102dcb116817a0c3830c510e4
|
|
|
|
|
|
|
|
| |
MappedIterator is primarily used by JobQueue.
Bug: T307304
Bug: T289879
Change-Id: Idf8ea28d4b6dc4b9d16cf86d3e5f236ad5ee64ae
|
|
|
|
|
| |
Bug: T311569
Change-Id: Iece1f1d6cc0671f6fa44e1c996b747406b6f6038
|
|
|
|
|
|
|
|
|
|
|
| |
This is mostly about adding return types to methods that implement PHP
interfaces, and not passing null to core functions that want a string.
After this patch, and an update to return types in RemexHtml,
tests/phpunit/integration/ has no more errors than in PHP 8.0.
Bug: T289879
Bug: T289926
Change-Id: Ia424f5cc897070f4188ae126b5bf6a1f552db0e1
|
|
|
|
|
|
| |
Found using IntelliJ's "Typo" code inspection.
Change-Id: I746220ebe6e1e39f6cb503390ec9053e6518cf16
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
| |
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
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The functions returning null or the class property is set explict null.
Some function should not accept null or return null.
Found by phan strict checks
Change-Id: Ie50f23249282cdb18caa332f562a3945a58d86ff
|
| |
| |
| |
| |
| |
| | |
Found by phan strict checks
Change-Id: If41d16b473baddd92cc4261cdc2bfbe65fedcb19
|
| |
| |
| |
| |
| |
| |
| |
| | |
Avoid leaking a null value in the list of paths
Found by phan strict checks
Change-Id: Iffbd0a1d2cd05c9453fc7bca698095787f733f6c
|
|/
|
|
|
|
|
|
|
| |
Some function already document "False on failure", but does not document
it on the used type
Found by phan strict checks
Change-Id: I12eb8bbc99179833ee3e42c1a7d1dc1443682ca6
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Some functions accept only string, cast ints and floats to string
* After preg_matches or explode() casts numbers to int to do maths
* Cast unix timestamps to int to do maths
* Cast return values from timestamp format function to int
* Cast bitwise operator to bool when needed as bool
* php internal functions like floor/round/ceil documented to return
float, most cases the result is used as int, added casts
Found by phan strict checks
Change-Id: Icb2de32107f43817acc45fe296fb77acf65c1786
|
|
|
|
|
|
|
|
| |
The functions returning null or the class property is set explict null
Found by phan strict checks
Change-Id: I4a271093fb6526564d8083a08249c64cb21f2453
|
|
|
|
| |
Change-Id: I2eb133a9e32116cd155f59086245bc4d15ecbfcc
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Don't catch and discard exceptions from the RequestTimeout library,
except when the exception is properly handled and the code seems to be
trying to wrap things up.
In most cases the exception is rethrown. Ideally it should instead be
done by narrowing the catch, and this was feasible in a few cases. But
sometimes the exception being caught is an instance of the base class
(notably DateTime::__construct()). Often Exception is the root of the
hierarchy of exceptions being thrown and so is the obvious catch-all.
Notes on specific callers:
* In the case of ResourceLoader::respond(), exceptions were caught for API
correctness, but processing continued. I added an outer try block for
timeout handling so that termination would be more prompt.
* In LCStoreCDB the Exception being caught was Cdb\Exception not
\Exception. I added an alias to avoid confusion.
* In ImageGallery I added a special exception class.
* In Message::__toString() the rationale for catching disappears
in PHP 7.4.0+, so I added a PHP version check.
* In PoolCounterRedis, let the shutdown function do its thing, but
rethrow the exception for logging.
Change-Id: I4c3770b9efc76a1ce42ed9f59329c36de04d657c
|
|
|
|
|
|
|
|
| |
When the called function has a doc of int, it should be cast to be
explicit here.
Also cast for arithmetic operations to be explicit about the number
Change-Id: I905b78dfb66e66443e0e3203488bab5b548db543
|
|
|
|
| |
Change-Id: Id86769ca81ff65707edde520585aa9ea117123e1
|
|
|
|
| |
Change-Id: I0748e0d5962fa909fdd6b7fcae4ab259bde4cdf1
|