Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[7.x] Fixed increment bug that changes expiration to forever #32875

Merged
merged 1 commit into from
May 18, 2020

Conversation

brianwozeniak
Copy link
Contributor

@brianwozeniak brianwozeniak commented May 18, 2020

A bug was introduced recently when changing:

if (! isset($this->storage[$key])) {

to

if ($existing = $this->get($key)) {

When attempting to increment a value that starts from zero (0), before it worked correctly when evaluating if the item was in the cache. However, now when $this->get($key) returns 0 since we are incrementing from 0 (the item has a value of 0), it evaluates as false and thus changes expiration to "forever". This causes issues for testing rate limiting because nothing ever "expires".

A bug was introduced recently when changing:

```
if ($existing = $this->get($key)) {
```

to

```
if (! isset($this->storage[$key])) {
```

When attempting to increment a value that starts from zero (0), before it worked correctly in that it was simply returning true in that a value was set. However, now when `$this->get($key)` returns 0 since we are incrementing from 0, it evaluates as false and thus changes expiration to "forever". This causes issues for testing rate limiting because nothing ever "expires".
@taylorotwell taylorotwell merged commit 340e451 into laravel:7.x May 18, 2020
@GrahamCampbell GrahamCampbell changed the title Fixed increment bug that changes expiration to forever [7.x] Fixed increment bug that changes expiration to forever May 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants