浏览代码

Update Core\Config

Regular expression fix for https://github.com/forkbb/forkbb/commit/47ee32f4da00f2100b03f8e054f47464abf01253
It would be correct to make a recursive regex, but I'm completely too lazy to figure it out :(
Visman 3 年之前
父节点
当前提交
2bf8f6ba46
共有 1 个文件被更改,包括 25 次插入1 次删除
  1. 25 1
      app/Core/Config.php

+ 25 - 1
app/Core/Config.php

@@ -88,7 +88,31 @@ class Config
     {
     {
         if (
         if (
             false === \preg_match_all(
             false === \preg_match_all(
-                '%//[^\r\n]*+|#[^\r\n]*+|/\*.*?\*/|\'.*?(?<!\\\\)\'|".*?(?<!\\\\)"|\s+|\[|\]|,|=>|\S+(?<![,\]\)])%s',
+                '%
+                    //[^\r\n]*+
+                |
+                    \#[^\r\n]*+
+                |
+                    /\*.*?\*/
+                |
+                    \'.*?(?<!\\\\)\'
+                |
+                    ".*?(?<!\\\\)"
+                |
+                    \s+
+                |
+                    \[
+                |
+                    \]
+                |
+                    ,
+                |
+                    =>
+                |
+                    function\s*\(.+?\)\s*\{.*?\}(?=,)
+                |
+                    \S+(?<![,\]\)])
+                %sx',
                 \substr($this->fileContents, $this->arrayStartPos),
                 \substr($this->fileContents, $this->arrayStartPos),
                 $matches
                 $matches
             )
             )