They can only be strings or integers. Anything else is wrong. We
should be throwing exceptions here so developers find this early
when running tests and manual testing.
Exceptions (instead of warnings) allow us to get a full useful
stacktrace.
Change-Id: I823ce33523283509c14a05f816f261d6b400e243
The rest of this class supports having a key with a null value by using
array_key_exists() instead of isset(). So Use $this->has() in
getWithSetCallback() so a null value is still identified as set.
Change-Id: Ida74a6f7e284e98f9a7d76d97312ebe2ee343f10
Check the MapCacheLRU::get() return value properly for misses
this time.
This reverts commit 1f022240c7.
Change-Id: Ic95b79ad8d7d7c788f406d45c0e9bedeeb8d220b
The logic was a bit hard to follow as there were two layers of
caching and a conditional (expiry being set).
* Move fetch logic for revision text to a private method.
* Call directly when cache is disabled.
* Simplify cache has/get/set by using getWithSetCallback.
Change-Id: Icd74cd8e944266c20dc7c5cb25f56300636dce1e
* Consistently refer to above zero as '> 0', not ">= 1" or "not <= 0".
* Remove superfluous comment that say what ping() does.
Change-Id: I25d276faa555e02feb99e656eb9cb7071f8205c0
This introduces https://github.com/wmde/Assert as a dependency,
as discussed in the RFC T91071.
This change uses assertions to check some parameters in some places,
to showcase the main intended use case for assertions in MediaWiki.
Bug: T91071
Change-Id: I93ac39b7c146f10532e37b51d973b59b9c424b2f
This broke a few things, and the debug line was basically pointless.
Instead, continue to only throw an exception if $text is an object, but only
warn if it's otherwise not a string.
This reverts commit 372ded2fea.
Change-Id: I060da9191cdbd00c4873caba875bfb77c917bcd7
This prevents warnings from PHP from array_key_exists().
Also make sure Title::newFromText throws an exception before it can trigger this.
Bug: T76305
Change-Id: I2b36b7a3b96b37e29fe06f69c13a185b3ec592a7