mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 17:59:48 +00:00
Config: Properly prevent keys getting transformed into bools
The original regex almost completely failed at its objective, because it a) only worked if there was no value for the key, and b) did not prevent all such occurrences getting transformed, while quoting patterns that would not get transformed anyway.
This commit is contained in:
@ -111,7 +111,7 @@ class Config{
|
||||
* @return string
|
||||
*/
|
||||
public static function fixYAMLIndexes(string $str) : string{
|
||||
return preg_replace("#^([ ]*)([a-zA-Z_]{1}[ ]*)\\:$#m", "$1\"$2\":", $str);
|
||||
return preg_replace("#^( *)(y|Y|yes|Yes|YES|n|N|no|No|NO|true|True|TRUE|false|False|FALSE|on|On|ON|off|Off|OFF)( *)\:#m", "$1\"$2\"$3:", $str);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user