On July 12 2011 in df2306b97 Roan added this workaround
for parse_url lacking support for protocol-relative URLs.
In 2012 PHP 5.4.7 came out, that added support for
protocol-relative URLs to parse_url, see [1].
It's 2021, and after a decade of honorably serving our
community, this workaround can be now be retired.
It's not a simple deletion since we have custom 'delimiter'
bit that wfParseUrl returns, and we need to keep supporting
that.
[1] https://bugs.php.net/bug.php?id=62844
Change-Id: If9b3bb2a51afa7af1ba8e674eadaa8db4f6f33f9
I intent to remove Profiler::getContext/setContext after a week
without deprecation. I consider these methods as internal (they
predate the stable interface policy, and we forgot to triage this
class, it has neither `@stable` nor `@internal`).
The hard-deprecation in this commit is to detect any use that may
have gone unnoticed in WMF production from Codesearch analysis alone,
where no usage was found.
Bug: T292269
Change-Id: Id40679f21cc7a3f77a1b96a4bbd55daeaea16892
$wgShellLocale was a flawed solution to the problem of locale
dependence. MediaWiki has its own concept of locale (the Language
hierarchy) and any kind of dependence on the server's libc locale is
incorrect and harmful, leading to bugs. Developers have an expectation
that functions like strtolower() will work in a certain way, and
respecting the locale set in the environment at install time violates
this expectation.
The problems with using C as a locale, which led to $wgShellLocale, are:
* escapeshellarg() will strip non-ASCII characters. This can be worked
around by not using it. The security vulnerability it was trying to
fix can be prevented in another way.
* Shell commands like rsvg will fail to correctly interpret UTF-8
arguments. This is the reason for the putenv(). On Linux, this can
be fixed by using C.UTF-8, which we didn't know at the time. On
Windows, the problem is not relevant (there are unrelated issues
with UTF-8 arguments).
Bug: T291234
Change-Id: Ib5ac0e7bc720dcc094303a358ee1c7bbdcfc6447
This is done without a deprecation process since the function is
@internal and completely unused outside of core.
Bug: T291341
Change-Id: I4b074f83f9be67b5b5bc2d33b2a6a55bb109a2b3
The global function wfGetLB() is deprecated since 1.27
and unused. This patch now makes it emit deprecation
warnings.
Depends-On: I5c719f5f96ced15ffd027b5d0d6fe1a41d2a61b9
Change-Id: I95bd3c7ec31625170fd7e8e2ff6017676a425dae
Can return null, per the documentation block and the code itself,
or false if wfTimestamp() returns false, but the @return tag
says its always a string.
Also clarify wfTimestamp() documentation that it returns
a string or false, never true.
Change-Id: I67340ad9316e1150ad2e7c2eb71d9b90112b69d2
The global function wfFindFile() is deprecated since 1.34 and unused.
This patch now makes it emit deprecation warnings.
Depends-On: Idbb4762ee3097884eee234633fecf2e363cbdcd4
Change-Id: I419310f8507f3a8a1d8cf385ca51954623a8d814
The global function wfLocalFile() is deprecated since 1.34 and unused.
This patch now makes it emit deprecation warnings.
Change-Id: Ib9f94b4f49e7720bd4455d019995037eaa4e3980
All hard deprecated in 1.35
* BeforeHttpsRedirect
* CanIPUseHTTPS
* UserRequiresHTTPS
Also soft deprecate the wfCanIPUseHTTPS
method, which always returns true. Will
be hard deprecated once callers are updated
Change-Id: Ie6d71809d09edf6be9b8280debeb152ef7fce398
Typehinting parameters that take the return value of these methods
with Language is not safe as they may return global $wgLang which
may or may not be instance of Language.
Bug: T278429
Change-Id: Ia5a71e4c39124f4427bd816e6e19207bb371cc6b
Replace the global variable hack in wfResetOutputBuffers() with a check
for the PHP_OUTPUT_HANDLER_CLEAN flag in the $phase parameter, available
since PHP 5.4.0. Aaron's Content-Length patch will work if applied on top
of this.
Bug: T278579
Change-Id: I9ec12f499821826038a39ebe94eed136f123b078
This is micro-optimization of closure code to avoid binding the closure
to $this where it is not needed.
Created by I25a17fb22b6b669e817317a0f45051ae9c608208
Change-Id: I0ffc6200f6c6693d78a3151cb8cea7dce7c21653
* Add $wgRequestTimeLimit. If it is non-null, it starts a time limit,
using Excimer with a fallback to set_time_limit().
* Add pretty formatting of timeout exceptions thrown by the library.
Related refactoring.
* Expose the library's critical section feature in MediaWikiServices
* In Setup.php, call warnIfHeadersSent() before sending session headers.
This helped to debug a related issue I had.
* In wfTransactionalTimeLimit() use the new library, and respect the
existing library time limit if it is larger than
$wgTransactionalTimeLimit.
Bug: T269326
Depends-On: I6409ad8a5cba775c27b0d5a79d3300c4dac4c91a
Change-Id: I2e6f6351c451407c06cc7e20932548f7b62e36b6
parse_url() on PHP >= 8 will include an empty 'query' bit for input URLs that
end in '?' and have no query string, such as 'http://www.example.com/foo?'.
This causes the parser test for T4372 to break. Accordingly, fix wfAssembleUrl()
to not generate a query string if the input query field is empty.
Bug: T268852
Change-Id: Ief9c15cc8fe0fcae07d2cc3120db9ca95573324c
For example, documenting the method getUser() with "get the User
object" does not add any information that's not already there.
But I have to read the text first to understand that it doesn't
document anything that's not already obvious from the code.
Some of this is from a time when we had a PHPCS sniff that was
complaining when a line like `@param User $user` doesn't end
with some descriptive text. Some users started adding text like
`@param User $user The User` back then. Let's please remove
this.
Change-Id: I0ea8d051bc732466c73940de9259f87ffb86ce7a