瀏覽代碼

Fix Core\Csrf

Visman 4 年之前
父節點
當前提交
84c010cf2c
共有 1 個文件被更改,包括 1 次插入3 次删除
  1. 1 3
      app/Core/Csrf.php

+ 1 - 3
app/Core/Csrf.php

@@ -55,7 +55,6 @@ class Csrf
      */
     public function create(string $marker, array $args = [], /* string|int */ $time = null): string
     {
-        $this->error = null;
         $marker      = $this->argsToStr($marker, $args);
         $time        = $time ?: \time();
 
@@ -67,7 +66,6 @@ class Csrf
      */
     public function createHash(string $marker, array $args = [], /* string|int */ $time = null): string
     {
-        $this->error = null;
         $marker      = $this->argsToStr($marker, $args, ['hash']);
         $time        = $time ?: \time() + $this->hashExpiration;
 
@@ -124,7 +122,7 @@ class Csrf
                     break;
                 // хэш
                 case 'e':
-                    if ($matches[2] < $now) {
+                    if ($matches[2] + 0 < $now) {
                         // просрочен
                         $this->error = 'Expired token';
                     } elseif (\hash_equals($this->createHash($marker, $args, $matches[2]), $token)) {