Browse Source

fix replace

tags/2.0.3
0nepeop1e 4 years ago
parent
commit
714d7d6b34
1 changed files with 2 additions and 1 deletions
  1. 2
    1
      src/SenangPayDriver.php

+ 2
- 1
src/SenangPayDriver.php View File

89
     public function computeHash($payload)
89
     public function computeHash($payload)
90
     {
90
     {
91
         $query = http_build_query($payload);
91
         $query = http_build_query($payload);
92
-        $query = preg_replace('/(^|&)hash=[^&]*($|&)/','$1hash=[HASH]$2', $query);
92
+        $key = preg_quote(http_build_query([$this->keyMap['hash']=>'']), '/');
93
+        $query = preg_replace('/(^|&)'.$key.'[^&]*($|&)/','$1hash=[HASH]$2', $query);
93
         return md5($this->secret_key . '?' . $query);
94
         return md5($this->secret_key . '?' . $query);
94
     }
95
     }
95
 }
96
 }

Loading…
Cancel
Save