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
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: I92daeb0f7be8a0566fd9258f66ed3aced9a7b792
Many files were in the autoloader despite having potentially harmful
file-scope code.
* Exclude all CommandLineInc maintenance scripts from the autoloader.
* Introduce "NO_AUTOLOAD" tag which excludes the file containing it
from the autoloader. Use it on CommandLineInc.php and a few
suspicious-looking files without classes in case they are refactored
to add classes in the future.
* Add a test which parses all non-PSR4 class files and confirms that
they do not contain dangerous file-scope code. It's slow (15s) but
its results were enlightening.
* Several maintenance scripts define constants in the file scope,
intending to modify the behaviour of MediaWiki. Either move the
define() to a later setup function, or protect with NO_AUTOLOAD.
* Use require_once consistently with Maintenance.php and
doMaintenance.php, per the original convention which is supposed to
allow one maintenance script to use the class of another maintenance
script. Using require breaks autoloading of these maintenance class
files.
* When Maintenance.php is included, check if MediaWiki has already
started, and if so, return early. Revert the fix for T250003 which
is incompatible with this safety measure. Hopefully it was superseded
by splitting out the class file.
* In runScript.php add a redundant PHP_SAPI check since it does some
things in file-scope code before any other check will be run.
* Change the if(false) class_alias(...) to something more hackish and
more compatible with the new test.
* Some site-related scripts found Maintenance.php in a non-standard way.
Use the standard way.
* fileOpPerfTest.php called error_reporting(). Probably debugging code
left in; removed.
* Moved mediawiki.compress.7z registration from the class file to the
caller.
Change-Id: I1b1be90343a5ab678df6f1b1bdd03319dcf6537f
'uca-default-u-kn' is a valid name for MediaWiki's category collation
functionality ($wgCategoryCollation / Collation class), not for PHP's
collation functionality (Collator class).
'uca-default-u-kn' for Collation maps to 'root-u-kn' for Collator
(see Collation::factory()), and the '-u-kn' suffix is later stripped
to enable numeric collation (see IcuCollation::_construct()).
This doesn't seem to result in any changes in the output.
Change-Id: I8cc7d283aee5408f8b7bed365661ff286236a694
This allows the script to be used by MediaWiki extensions.
Example in UploadWizard: I181dda3ca3ef3f43e863482057b4949c1bc32e9b.
Change-Id: Ib121c6e226bdc1b3a8976c96b8d9f21546a1b5d3
* Add an updateCredits.php script that will merge the existing
contributors list with a list generated using git-log.
* Update the existing .mailmap file to de-duplicate author list
* Update CREDITS using updateCredits.php
Bug: T139300
Change-Id: If00ae955c8026d6be38575f3766a06c46e5e7126