浏览代码

* Fix Illegal string offset for PHP 7.1

Visman 6 年之前
父节点
当前提交
5f5dba3ff7
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      app/Core/Validator.php

+ 3 - 0
app/Core/Validator.php

@@ -187,6 +187,9 @@ class Validator
                  $rules[$vs[0]] = isset($vs[1]) ? $vs[1] : '';
             }
             if (isset($suffix)) {
+                if (isset($this->rules[$field]['array']) && ! \is_array($this->rules[$field]['array'])) {
+                    $this->rules[$field]['array'] = [];
+                }
                 $this->rules[$field]['array'][$suffix] = $rules;
             } else {
                 $this->rules[$field] = $rules;