Skip to content

Conversation

@Girgias
Copy link
Member

@Girgias Girgias commented Feb 9, 2026

This also fixes bug 71162.

I'm targeting master with this change as it is long-standing behaviour, but I don't really understand why an "empty session" would fail to encode. Similarly, with a "partial" encoding of it when discarding numeric keys.

The biggest impact is that session_encode() now only returns false in very limited cases and for empty sessions returns an empty string, which is how it was encoded anyway when actually performing session writes.

// TODO warn that ID cannot be verified? else { }
}
/* Read is required to make new session data at this point. */
zend_string *data;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should be initialised to NULL wdyt ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, it wasn't previously though, so is that a bug then do you think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure all callbacks guarantee initialisation, this is all I m saying but I do not session that well :)

smart_str_appendc(&buf, PS_DELIMITER);
php_var_serialize(&buf, struc, &var_hash);
);
PHP_VAR_SERIALIZE_DESTROY(var_hash);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This introduces a bug: now var_hash is destroyed twice because it is already destroyed at line 1039 too. I think you may drop line 1039.

// TODO warn that ID cannot be verified? else { }
}
/* Read is required to make new session data at this point. */
zend_string *data;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, it wasn't previously though, so is that a bug then do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants