refactor: add int type hint to gc() in all session handlers - #10418
Merged
Conversation
michalsn
requested changes
Jul 20, 2026
michalsn
left a comment
Member
There was a problem hiding this comment.
Quite an unrealistic scenario, but still a valid fix.
Please add a changelog entry.
gr8man
added a commit
to gr8man/CodeIgniter4
that referenced
this pull request
Jul 20, 2026
- Add Unreleased section to CHANGELOG.md with PR codeigniter4#10418 entry - Consolidate testGCRejectsNonInt to test 6 non-int types in one method - Remove unrelated testGCWithZero and testGCWithNegativeValue tests - Add v4.7.5 RST changelog entry for session gc type hint
gr8man
force-pushed
the
fix/session-gc-sqli-type-hint
branch
from
July 20, 2026 18:09
4079bbb to
fc5d53c
Compare
michalsn
requested changes
Jul 21, 2026
michalsn
left a comment
Member
There was a problem hiding this comment.
Please rebase into the 4.8 branch, as this will be a more appropriate release for these changes. Also, please change this method signature for all handlers.
paulbalandan
requested changes
Jul 22, 2026
paulbalandan
left a comment
Member
There was a problem hiding this comment.
This is a refactor, and as mentioned should be targeting 4.8 branch instead.
Add int type hint to $max_lifetime in gc() for all 6 session handlers to match SessionHandlerInterface, preventing SQL injection from non-integer input. Includes changelog entry in v4.8.0.rst under Method Signature Changes.
gr8man
force-pushed
the
fix/session-gc-sqli-type-hint
branch
from
July 29, 2026 20:10
2124cc3 to
e4bb6fd
Compare
paulbalandan
approved these changes
Jul 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Added int type hint to $max_lifetime in all 6 session handlers' gc() to match SessionHandlerInterface. This prevents SQL injection from non-integer input by rejecting it with a
TypeError.Affected handlers: ArrayHandler, DatabaseHandler, FileHandler, MemcachedHandler, PostgreHandler, RedisHandler.
Checklist: