php / php/php-src

session.lazy_write only implemented if user defines custom handler with updateTimestamp method - Incorrect behavior

Open
#15,135 6 comments 0 reactions 1 assignee View on GitHub

@devnexen is already working on this.

Since Jul 29, 2024.

Extension: session Feature Status: Needs Triage
Dominant language
C
Stars
40.4k
Forks
8.1k
Avg merge
2d 13h
Merged PRs (30d)
96

Description

Description

The following code:

https://github.com/php/php-src/blob/21e01f3e70308824169632d5a16047f9df52fac9/ext/session/session.c#L515-L522

Will not call updateTimestamp unless PS(mod)->s_update_timestamp exists & is different to the inbuilt updateTimestamp function (php_session_update_timestamp defined in https://github.com/php/php-src/blob/21e01f3e70308824169632d5a16047f9df52fac9/ext/session/session.c#L1105). It will always call the standard inbuilt file write handler instead.

Given that session.lazy_write defaults to 1 --> True, the expectation is that the session file will not be overwritten if there isn't a change in session value. But this will always happen unless there is a defined custom handler.

PHP Version

PHP 8.2

Operating System

Ubuntu 22.04 LTS

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.