Skip to content

fix: add create_sid() and validateId() to the session BaseHandler for PHP 8.6 - #10802

Draft
paulbalandan wants to merge 1 commit into
codeigniter4:4.8from
paulbalandan:session-create-sid
Draft

paulbalandan wants to merge 1 commit into
codeigniter4:4.8from
paulbalandan:session-create-sid

Conversation

@paulbalandan

Copy link
Copy Markdown
Member

Description
Depends on #10685 to be tested in CI.

PHP 8.6 warns at class load when a SessionHandlerInterface implementation lacks create_sid() or validateId(), and PHP 9.0 requires both. CodeIgniter's error handler turns that warning into an exception, so the session handlers fail to load on 8.6.

BaseHandler now provides both methods:

  • create_sid() returns 32 hex characters from random_bytes(), the format Session::configure() enforces.
  • validateId() reports only the last created ID as unused. Always returning true makes PHP retry ID creation three times on every session_regenerate_id().

updateTimestamp() and the two extra interfaces are not added, since PHP 8.6 detects the methods by name.

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value (without duplication)
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@carson-codeigniter4 carson-codeigniter4 Bot added 4.8 PRs that target the `4.8` branch. bug Verified issues on the current code behavior or pull requests that will fix them labels Nov 20, 2026
@paulbalandan
paulbalandan marked this pull request as draft November 20, 2026 14:32
@paulbalandan
paulbalandan marked this pull request as ready for review November 20, 2026 14:56
@ddevsr ddevsr mentioned this pull request Nov 20, 2026
6 of 10 tasks
@paulbalandan
paulbalandan marked this pull request as draft November 21, 2026 09:45
@carson-codeigniter4 carson-codeigniter4 Bot added the stale Pull requests with conflicts label Nov 24, 2026
@carson-codeigniter4

This comment has been minimized.

@carson-codeigniter4 carson-codeigniter4 Bot removed the stale Pull requests with conflicts label Nov 24, 2026
@carson-codeigniter4 carson-codeigniter4 Bot added the stale Pull requests with conflicts label Nov 25, 2026
@carson-codeigniter4 carson-codeigniter4 Bot removed the stale Pull requests with conflicts label Nov 25, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4.8 PRs that target the `4.8` branch. bug Verified issues on the current code behavior or pull requests that will fix them

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants