Skip to content

Bug: memcached support broken for CI4 sessions #9940

@rutgers-master

Description

@rutgers-master

PHP Version

8.4

CodeIgniter4 Version

4.7.0

CodeIgniter4 Installation Method

Composer (using codeigniter4/appstarter)

Which operating systems have you tested for this bug?

Linux

Which server did you use?

apache

Environment

production

Database

No response

What happened?

memcached support is broken in CI 4.7.0 because of the accidental change to this line:

if ($this->savePath !== '') {

It should be "if ($this->savePath === '') {".

There was a commit done on 1/1/2026:
772eaf4
The original line was "if (empty($this->savePath)) {" new line is doing not empty which is not correct.

Steps to Reproduce

Upgrade to CI 4.7.0 and in your .env file set:

session.driver = 'CodeIgniter\Session\Handlers\MemcachedHandler'
session.expiration = 7200
session.savePath = 'localhost:11211'

Try and access CodeIgniter and it will say:

CodeIgniter\Session\Exceptions\SessionException
Session: No save path configured.

And the error points to:

66         if ($this->savePath !== '') {
67             throw SessionException::forEmptySavepath();
68         }

Expected Output

If we change "if ($this->savePath !== '') {" to "if ($this->savePath === '') {" in the MemcachedHandler.php then it works as expected.

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugVerified issues on the current code behavior or pull requests that will fix them

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions