Skip to content

Commit

Permalink
bug symfony#54776 [Cache] fix: remove unwanted cast to int (Arend Hum…
Browse files Browse the repository at this point in the history
…meling)

This PR was merged into the 5.4 branch.

Discussion
----------

[Cache] fix: remove unwanted cast to int

| Q             | A
| ------------- | ---
| Branch?       |  5.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? |no
| Issues        | Fix symfony#54773
| License       | MIT

As discussed in the related issue, this type cast is unnecessary and can lead to unexpected behavior due to integer overflow.

I took a quick look if a testcase could be implemented, but this is not so trivial, as we'd either have to somehow configure a redis server to end up with a state that results in very high scan cursor values, or we'd have to implement a mock for the redis implementation, so we can provide all the edge case values for our tests.

Commits
-------

3d174a9 fix: remove unwanted type cast
  • Loading branch information
nicolas-grekas committed Apr 30, 2024
2 parents b4f9da4 + 3d174a9 commit ad0caee
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Symfony/Component/Cache/Traits/RedisTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ protected function doClear(string $namespace)
}
$this->doDelete($keys);
}
} while ($cursor = (int) $cursor);
} while ($cursor);
}

return $cleared;
Expand Down

0 comments on commit ad0caee

Please sign in to comment.