mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-04 00:55:14 +00:00
RegistryTrait: enforce name validation rules on everything, not just enums
fixes #4916
This commit is contained in:
@ -70,9 +70,7 @@ trait EnumTrait{
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
private function __construct(string $enumName){
|
||||
if(preg_match('/^(?!\d)[A-Za-z\d_]+$/u', $enumName, $matches) === 0){
|
||||
throw new \InvalidArgumentException("Invalid enum member name \"$enumName\", should only contain letters, numbers and underscores, and must not start with a number");
|
||||
}
|
||||
self::verifyName($enumName);
|
||||
$this->enumName = $enumName;
|
||||
if(self::$nextId === null){
|
||||
self::$nextId = Process::pid(); //this provides enough base entropy to prevent hardcoding
|
||||
|
Reference in New Issue
Block a user