Regarding this bug: http://bugs.php.net/bug.php?id=29322&edit=1
And by looking at this commit by Andi:
http://cvs.php.net/diff.php/php-src/ext/session/session.c?r1=1.391&r2=1.392&ty=u
and this part of it:
-
REGISTER_STRINGL_CONSTANT("SID", empty_string, 0, 0);
-
REGISTER_STRINGL_CONSTANT("SID", "", 0, 1);
Where flags changed from 0 to 1..
Intentional or not?--Jani
Yes, the flag change was intentional in order to create an allocated empty
string.
I doubt this has anything to do with the bug report though.
At 11:04 AM 5/31/2005 +0300, Jani Taskinen wrote:
Regarding this bug: http://bugs.php.net/bug.php?id=29322&edit=1 And by looking at this commit by Andi:
http://cvs.php.net/diff.php/php-src/ext/session/session.c?r1=1.391&r2=1.392&ty=u
and this part of it:
REGISTER_STRINGL_CONSTANT("SID", empty_string, 0, 0);
REGISTER_STRINGL_CONSTANT("SID", "", 0, 1);
Where flags changed from 0 to 1..
Intentional or not?--Jani
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
Jani,
The flag chance was not intentional. I think I made that change as part of
a change to nuke empty_string() and that change to 1 was supposed to tell
REGISTER_STRINGL_CONSTANT to dup the string. My mistake and I think it
should be reverted. I confused it with the RETURN_* macros.
Andi
At 07:27 AM 5/31/2005 -0700, Andi Gutmans wrote:
Yes, the flag change was intentional in order to create an allocated empty
string.
I doubt this has anything to do with the bug report though.At 11:04 AM 5/31/2005 +0300, Jani Taskinen wrote:
Regarding this bug: http://bugs.php.net/bug.php?id=29322&edit=1 And by looking at this commit by Andi:
http://cvs.php.net/diff.php/php-src/ext/session/session.c?r1=1.391&r2=1.392&ty=u
and this part of it:
REGISTER_STRINGL_CONSTANT("SID", empty_string, 0, 0);
REGISTER_STRINGL_CONSTANT("SID", "", 0, 1);
Where flags changed from 0 to 1..
Intentional or not?--Jani