mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-11 04:17:48 +00:00
ServerConfigGroup: do not assume that values are always bool|string
This commit is contained in:
parent
847e24fc41
commit
dc2e8e7e8f
@ -110,16 +110,20 @@ final class ServerConfigGroup{
|
|||||||
}else{
|
}else{
|
||||||
$value = $this->serverProperties->exists($variable) ? $this->serverProperties->get($variable) : $defaultValue;
|
$value = $this->serverProperties->exists($variable) ? $this->serverProperties->get($variable) : $defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(is_bool($value)){
|
if(is_bool($value)){
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
switch(strtolower($value)){
|
if(is_int($value)){
|
||||||
case "on":
|
return $value !== 0;
|
||||||
case "true":
|
}
|
||||||
case "1":
|
if(is_string($value)){
|
||||||
case "yes":
|
switch(strtolower($value)){
|
||||||
return true;
|
case "on":
|
||||||
|
case "true":
|
||||||
|
case "1":
|
||||||
|
case "yes":
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -40,11 +40,6 @@ parameters:
|
|||||||
count: 2
|
count: 2
|
||||||
path: ../../../src/ServerConfigGroup.php
|
path: ../../../src/ServerConfigGroup.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Parameter \\#1 \\$string of function strtolower expects string, mixed given\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: ../../../src/ServerConfigGroup.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Cannot access offset 'git' on mixed\\.$#"
|
message: "#^Cannot access offset 'git' on mixed\\.$#"
|
||||||
count: 2
|
count: 2
|
||||||
|
Loading…
x
Reference in New Issue
Block a user