Skip to content

Commit

Permalink
Merge pull request #7 from mariojrrc/master
Browse files Browse the repository at this point in the history
Prevent exception when using filesystem cache and clients ip as storage key
  • Loading branch information
Lansoweb authored Oct 24, 2021
2 parents fbb05dc + e3d178c commit 58f62a8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/RateLimitMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
use function explode;
use function filter_var;
use function is_array;
use function str_replace;
use function time;

class RateLimitMiddleware implements MiddlewareInterface
Expand Down Expand Up @@ -72,6 +73,8 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
if (empty($key)) {
throw new MissingRequirement('Could not detect the client IP');
}

$key = str_replace('.', '-', $key);
}

$data = $this->storage->get($key);
Expand Down

0 comments on commit 58f62a8

Please sign in to comment.