Skip to content

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

Open
@shimscharf

Description

@shimscharf

Description

The following code:

if (PS(lazy_write) && PS(session_vars)
&& PS(mod)->s_update_timestamp
&& PS(mod)->s_update_timestamp != php_session_update_timestamp
&& zend_string_equals(val, PS(session_vars))
) {
ret = PS(mod)->s_update_timestamp(&PS(mod_data), PS(id), val, PS(gc_maxlifetime));
handler_function_name = handler_class_name != NULL ? "updateTimestamp" : "update_timestamp";
} else {

Will not call updateTimestamp unless PS(mod)->s_update_timestamp exists & is different to the inbuilt updateTimestamp function (php_session_update_timestamp defined in

PHPAPI zend_result php_session_update_timestamp(PS_UPDATE_TIMESTAMP_ARGS) {
). 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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions