diff --git a/var/Typecho/Db/Adapter/PgsqlTrait.php b/var/Typecho/Db/Adapter/PgsqlTrait.php index 0f0447f2..b4d9d632 100644 --- a/var/Typecho/Db/Adapter/PgsqlTrait.php +++ b/var/Typecho/Db/Adapter/PgsqlTrait.php @@ -21,7 +21,7 @@ trait PgsqlTrait /** * @var string|null */ - private $lastTable = null; + private $lastInsertTable = null; /** * 清空数据表 @@ -70,7 +70,6 @@ trait PgsqlTrait { if (Db::INSERT == $action && !empty($table)) { $this->compatibleInsert = false; - $this->lastTable = $table; if (!isset($this->pk[$table])) { $resource = $this->query("SELECT @@ -96,10 +95,11 @@ WHERE // 使用兼容模式监听插入结果 if (isset($this->pk[$table])) { $this->compatibleInsert = true; + $this->lastInsertTable = $table; $query .= ' RETURNING ' . $this->quoteColumn($this->pk[$table]); } } else { - $this->lastTable = null; + $this->lastInsertTable = null; } } @@ -113,7 +113,7 @@ WHERE */ public function lastInsertId($resource, $handle): int { - $lastTable = $this->lastTable; + $lastTable = $this->lastInsertTable; if ($this->compatibleInsert) { $result = $this->fetch($resource); diff --git a/var/Typecho/Validate.php b/var/Typecho/Validate.php index bfc852a6..fbf75343 100644 --- a/var/Typecho/Validate.php +++ b/var/Typecho/Validate.php @@ -112,8 +112,7 @@ class Validate { return filter_var( $str, - FILTER_VALIDATE_URL, - FILTER_FLAG_SCHEME_REQUIRED | FILTER_FLAG_HOST_REQUIRED + FILTER_VALIDATE_URL ) !== false; } @@ -269,12 +268,12 @@ class Validate $rules = empty($rules) ? $this->rules : $rules; // Cycle through the rules and test for errors - foreach ($rules as $key => $rules) { + foreach ($rules as $key => $rule) { $this->key = $key; $data[$key] = (is_array($data[$key]) ? 0 == count($data[$key]) : 0 == strlen($data[$key])) ? null : $data[$key]; - foreach ($rules as $params) { + foreach ($rule as $params) { $method = $params[0]; if ('required' != $method && 'confirm' != $method && 0 == strlen($data[$key])) {