Skip to content

Conversation

@laruence
Copy link
Member

@laruence laruence commented Apr 15, 2016

The problem is:

if (has_value) {
    ZVAL_UNDEF(&current);
    if (php_var_unserialize(&current, (const unsigned char **) &p, (const unsigned char *) endptr, &var_hash)) {
        zval *zv = php_set_session_var(name, &current, &var_hash );
        var_replace(&var_hash, &current, zv);

php_set_session_var may cause http_session_vars resize, which will make the var in var_hash->data become invalid..

I propose to fix this by prepend a magic var "__SESS_N_VARS" to session serialized string, with this, we could know how many vars there before doing session decoding, and extend PS(http_session_vars) to the proper size, thus can avoding hash table resize, as this is a little tricky , so I make PR instead of pushing it directly.

thanks

@laruence laruence added the Bug label Apr 15, 2016
@laruence
Copy link
Member Author

laruence commented Apr 16, 2016

A better fixed has been committed 05d53de , close this one

@laruence laruence closed this Apr 16, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant