mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 11:39:43 +00:00
fixed parseProperties parsing stuff inside comments
This commit is contained in:
parent
42fef5f812
commit
627590cb86
1 changed files with 6 additions and 1 deletions
|
|
@ -185,7 +185,12 @@ class Config{
|
|||
* @param $content
|
||||
*/
|
||||
private function parseProperties($content){
|
||||
if(preg_match_all('/([a-zA-Z0-9\-_\.]*)=([^\r\n]*)/u', $content, $matches) > 0){ //false or 0 matches
|
||||
$content2 = "";
|
||||
foreach(explode("\n", $content) as $cnt){ //regex is very evil and malicious
|
||||
if((trim($cnt)[0] ?? "") == "#") continue;
|
||||
$content2 .= $cnt . "\n";
|
||||
}
|
||||
if(preg_match_all("/([a-zA-Z0-9\-_\.]*)=([^\r\n]*)/u", $content2, $matches) > 0){ //false or 0 matches
|
||||
foreach($matches[1] as $i => $k){
|
||||
$v = trim($matches[2][$i]);
|
||||
switch(strtolower($v)){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue