File tree 1 file changed +5
-3
lines changed
src/Symfony/Component/Lock/Store
1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -164,11 +164,13 @@ public function putOffExpiration(Key $key, $ttl)
164
164
165
165
$ key ->reduceLifetime ($ ttl );
166
166
167
- $ sql = "UPDATE $ this ->table SET $ this ->expirationCol = {$ this ->getCurrentTimestampStatement ()} + $ ttl, $ this ->tokenCol = :token WHERE $ this ->idCol = :id AND ( $ this ->tokenCol = :token OR $ this ->expirationCol <= {$ this ->getCurrentTimestampStatement ()}) " ;
167
+ $ sql = "UPDATE $ this ->table SET $ this ->expirationCol = {$ this ->getCurrentTimestampStatement ()} + $ ttl, $ this ->tokenCol = :token1 WHERE $ this ->idCol = :id AND ( $ this ->tokenCol = :token2 OR $ this ->expirationCol <= {$ this ->getCurrentTimestampStatement ()}) " ;
168
168
$ stmt = $ this ->getConnection ()->prepare ($ sql );
169
169
170
+ $ uniqueToken = $ this ->getUniqueToken ($ key );
170
171
$ stmt ->bindValue (':id ' , $ this ->getHashedKey ($ key ));
171
- $ stmt ->bindValue (':token ' , $ this ->getUniqueToken ($ key ));
172
+ $ stmt ->bindValue (':token1 ' , $ uniqueToken );
173
+ $ stmt ->bindValue (':token2 ' , $ uniqueToken );
172
174
$ stmt ->execute ();
173
175
174
176
// If this method is called twice in the same second, the row wouldn't be updated. We have to call exists to know if we are the owner
@@ -214,7 +216,7 @@ public function exists(Key $key)
214
216
*/
215
217
private function getHashedKey (Key $ key ): string
216
218
{
217
- return hash ('sha256 ' , $ key );
219
+ return hash ('sha256 ' , ( string ) $ key );
218
220
}
219
221
220
222
private function getUniqueToken (Key $ key ): string
You can’t perform that action at this time.
0 commit comments