aboutsummaryrefslogtreecommitdiffstats
path: root/includes/libs/filebackend/FileBackend.php
diff options
context:
space:
mode:
authorMax Semenik <maxsem.wiki@gmail.com>2020-05-05 10:51:29 +0300
committerMax Semenik <maxsem.wiki@gmail.com>2020-05-05 20:55:33 +0300
commit47f6b73231abf602f6b7497e466e9d8cd23a3b6a (patch)
tree7eabce2b53812f31cd55b936046a064d86fabf81 /includes/libs/filebackend/FileBackend.php
parent2a21e9963374bb11ef2bcad16297e687e59ae45b (diff)
downloadmediawikicore-47f6b73231abf602f6b7497e466e9d8cd23a3b6a.tar.gz
mediawikicore-47f6b73231abf602f6b7497e466e9d8cd23a3b6a.zip
FileBackend: Avoid undefined offset notices
While I'm at it, remove a pointless else. Bug: T248925 Change-Id: I3107cff5aaf07779aa900e8325f30a6a44bface9
Diffstat (limited to 'includes/libs/filebackend/FileBackend.php')
-rw-r--r--includes/libs/filebackend/FileBackend.php9
1 files changed, 7 insertions, 2 deletions
diff --git a/includes/libs/filebackend/FileBackend.php b/includes/libs/filebackend/FileBackend.php
index 07b8007fc53b..2ebbbdcaca99 100644
--- a/includes/libs/filebackend/FileBackend.php
+++ b/includes/libs/filebackend/FileBackend.php
@@ -191,12 +191,17 @@ abstract class FileBackend implements LoggerAwareInterface {
* @throws InvalidArgumentException
*/
public function __construct( array $config ) {
+ if ( !array_key_exists( 'name', $config ) ) {
+ throw new InvalidArgumentException( 'Backend name not specified.' );
+ }
$this->name = $config['name'];
$this->domainId = $config['domainId'] // e.g. "my_wiki-en_"
- ?? $config['wikiId']; // b/c alias
+ ?? $config['wikiId'] // b/c alias
+ ?? null;
if ( !preg_match( '!^[a-zA-Z0-9-_]{1,255}$!', $this->name ) ) {
throw new InvalidArgumentException( "Backend name '{$this->name}' is invalid." );
- } elseif ( !is_string( $this->domainId ) ) {
+ }
+ if ( !is_string( $this->domainId ) ) {
throw new InvalidArgumentException(
"Backend domain ID not provided for '{$this->name}'." );
}