> >-               REGISTER_STRINGL_CONSTANT("SID", empty_string, 0, 0);
> >+               REGISTER_STRINGL_CONSTANT("SID", "", 0, 1);
> >
> >     Where flags changed from 0 to 1..
> >     Intentional or not?
> >
> Yes, the flag change was intentional in order to create an allocated empty
> string.
>
The fourth parameter to REGISTER_STRINGL_CONSTANT is supposed to be flags
(e.g. CONST_CS, CONST_PERSIST) not a copy indicator.

The underlying implementation of zend_register_stringl_constant() never
copies value:

#define REGISTER_STRINGL_CONSTANT(name, str, len, flags)
zend_register_stringl_constant((name), sizeof(name), (str), (len), (flags),
module_number TSRMLS_CC)

ZEND_API void zend_register_stringl_constant(char *name, uint name_len, char
*strval, uint strlen, int flags, int module_number TSRMLS_DC)
{
    zend_constant c;

    c.value.type = IS_STRING;
    c.value.value.str.val = strval;
    c.value.value.str.len = strlen;
    c.flags = flags;
    c.name = zend_strndup(name, name_len-1);
    c.name_len = name_len;
    c.module_number = module_number;
    zend_register_constant(&c TSRMLS_CC);
}

By setting flags to 1 (the value of CONST_CS), the zend_register_constant()
function uses the unmodified "SID" as the constant name, rather than the
strtolower()'d "sid" which is what session_regenerate_id() attempts to
destroy.

-Sara

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to