Skip to content

Bug: Tempdata Expiration Issue when using bulk method #9534

@mhdh3lmi

Description

@mhdh3lmi

PHP Version

8.2

CodeIgniter4 Version

4.6

CodeIgniter4 Installation Method

Composer (using codeigniter4/appstarter)

Which operating systems have you tested for this bug?

Windows

Which server did you use?

apache

Database

MySQL 8

What happened?

When using the bulk method for setting session tempdata setTempdata($array, NULL, $time), the session data does not expire as expected after the specified time. However, when using the individual key-value method setTempdata($key, $value, $time), the expiration works correctly.

Steps to Reproduce

$data = ['key1' => 'value1'];
$session->setTempdata($data, NULL, 5);
$session->setTempdata('key2','value2',5);

Expected Output

From __ci_vars in $_SESSION, should be (expires in 5 seconds):
[key1] => 1745158235
[key2] => 1745158235

But it comes out as:

[key1] => 3490316465 (55 years in the future)
[key2] => 1745158235 (correct value)

Anything else?

Testing on PHP 8.3.15 + Linux also have the same issue.

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