mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-12 06:25:32 +00:00
Fix banlist crash when | is entered in any /ban arguments
This commit is contained in:
parent
f3e35bb94a
commit
d53810c6bc
@ -21,6 +21,8 @@
|
||||
|
||||
namespace pocketmine\permission;
|
||||
|
||||
use pocketmine\utils\MainLogger;
|
||||
|
||||
class BanEntry{
|
||||
public static $format = "Y-m-d H:i:s O";
|
||||
|
||||
@ -109,7 +111,12 @@ class BanEntry{
|
||||
$str = explode("|", trim($str));
|
||||
$entry = new BanEntry(trim(array_shift($str)));
|
||||
if(count($str) > 0){
|
||||
$entry->setCreated(\DateTime::createFromFormat(self::$format, array_shift($str)));
|
||||
$datetime = \DateTime::createFromFormat(self::$format, array_shift($str));
|
||||
if(!($datetime instanceof \DateTime)){
|
||||
MainLogger::getLogger()->alert("Error parsing date for BanEntry for player \"" . $entry->getName() . "\", the format may be invalid!");
|
||||
return $entry;
|
||||
}
|
||||
$entry->setCreated($datetime);
|
||||
if(count($str) > 0){
|
||||
$entry->setSource(trim(array_shift($str)));
|
||||
if(count($str) > 0){
|
||||
|
Loading…
x
Reference in New Issue
Block a user