Skip to content

FileStore: issue with deserialization when changing Date::now() #56075

Open
@murrant

Description

@murrant

Laravel Version

12.19.2

PHP Version

8.4.8

Database Driver & Version

No response

Description

When using the FileStore cache driver, if you store something in the cache with expiration while time traveling, it will break deserialization. This is because FileStore assumes a timestamp is 10 digits.

Steps To Reproduce

    public function test_write_and_fetch_file_cache_with_old_timestamp(): void
    {
        Date::withTestNow(Date::createFromTimestampUTC(990464400), function () {
            Cache::driver('file')->put('key', 'value', 3);
            $this->assertEquals('value', Cache::driver('file')->get('key'));
        });

        $this->assertEquals('value', Cache::driver('file')->get('key'));
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions