com php-src: Compatibility fix for ext/session/tests/session_ id_error3.phpt: ext/session/session.c
| From: | Dmitry Stogov | Date: | Thu, 10 Apr 2014 08:29:14 +0000 |
| Subject: | com php-src: Compatibility fix for ext/session/tests/session_ id_error3.phpt: ext/session/session.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-77441@lists.php.net to get a copy of this message | ||
Commit: 6df6006769733e6ec925d3ca59f40ec78251cf6f
Author: Dmitry Stogov <dmitry@zend.com> Thu, 10 Apr 2014 12:29:14 +0400
Parents: 23aecd1736c4457418a7eabdfedc2dee690c4346
Branches: phpng
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=6df6006769733e6ec925d3ca59f40ec78251cf6f
Log:
Compatibility fix for ext/session/tests/session_id_error3.phpt
Changed paths:
M ext/session/session.c
Diff:
diff --git a/ext/session/session.c b/ext/session/session.c
index acb17ce..31be691 100644
--- a/ext/session/session.c
+++ b/ext/session/session.c
@@ -1909,15 +1909,22 @@ static PHP_FUNCTION(session_save_path)
Return the current session id. If newid is given, the session id is replaced with newid */
static PHP_FUNCTION(session_id)
{
- char *name = NULL;
+ zend_string *name = NULL;
int name_len, argc = ZEND_NUM_ARGS();
- if (zend_parse_parameters(argc TSRMLS_CC, "|s", &name, &name_len) == FAILURE) {
+ if (zend_parse_parameters(argc TSRMLS_CC, "|S", &name) == FAILURE) {
return;
}
if (PS(id)) {
- RETVAL_STR(STR_COPY(PS(id)));
+ //??? keep compatibility for "\0" characters
+ //??? see: ext/session/tests/session_id_error3.phpt
+ int len = strlen(PS(id)->val);
+ if (UNEXPECTED(len != PS(id)->len)) {
+ RETVAL_STR(STR_INIT(PS(id)->val, len, 0));
+ } else {
+ RETVAL_STR(STR_COPY(PS(id)));
+ }
} else {
RETVAL_EMPTY_STRING();
}
@@ -1926,7 +1933,7 @@ static PHP_FUNCTION(session_id)
if (PS(id)) {
STR_RELEASE(PS(id));
}
- PS(id) = STR_INIT(name, name_len, 0);
+ PS(id) = STR_COPY(name);
}
}
/* }}} */