mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-21 16:24:05 +00:00
Fixed plugin name validation
Invalid characters in plugin names are no longer stripped. They always result in a load error. The behaviour of replacing spaces with underscores is not changed.
This commit is contained in:
parent
94feecd44b
commit
7f4b5d282e
@ -66,8 +66,8 @@ class PluginDescription{
|
||||
* @throws PluginException
|
||||
*/
|
||||
private function loadMap(array $plugin){
|
||||
$this->name = preg_replace("[^A-Za-z0-9 _.-]", "", $plugin["name"]);
|
||||
if($this->name === ""){
|
||||
$this->name = $plugin["name"];
|
||||
if(preg_match('/^[A-Za-z0-9 _.-]+$/', $this->name) === 0){
|
||||
throw new PluginException("Invalid PluginDescription name");
|
||||
}
|
||||
$this->name = str_replace(" ", "_", $this->name);
|
||||
|
Loading…
x
Reference in New Issue
Block a user