summaryrefslogtreecommitdiff
path: root/ext/session/session.c
diff options
context:
space:
mode:
authorXinchen Hui <laruence@gmail.com>2016-04-07 13:58:00 +0800
committerXinchen Hui <laruence@gmail.com>2016-04-07 13:58:00 +0800
commit079239a7cececfca9344b24f5bb1cca127d4bcc9 (patch)
treec02a94788db9aac4f3834a7029ce6af28e905b29 /ext/session/session.c
parent7e042224a26282938b866a49ca3d4af1b368c0cc (diff)
parent5ab950cb2ca362af3f718179f1da430922c1e0dd (diff)
downloadphp-git-079239a7cececfca9344b24f5bb1cca127d4bcc9.tar.gz
Merge branch 'PHP-7.0' of git.php.net:/php-src into PHP-7.0
* 'PHP-7.0' of git.php.net:/php-src: Remove __halt_compiler from semi-reserved tokens Fixed Bug #71974 Trans sid will always be send, even if cookies are available Optimized array_fill(). This is a perfect function for fast creation of packed arrays. Fixed build fix merge mistake fix tests PostgreSQL's PDOStatement::getColumnMeta() fills in table's name. fix indent Fixed bug #71978 (Existence of return type hint affects other compatibility rules) fix test fix bug #71667 (emulate how mssql extension names "computed" columns) update NEWS add 32-bit specific variont for #62498 skip test on 32-bit make opcache lockfile path configurable return zvals instead of strings, cast or not based on stringify attribute fix test add skip slow test
Diffstat (limited to 'ext/session/session.c')
-rw-r--r--ext/session/session.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/ext/session/session.c b/ext/session/session.c
index 238ae877f8..e745b96867 100644
--- a/ext/session/session.c
+++ b/ext/session/session.c
@@ -1483,7 +1483,7 @@ static void ppid2sid(zval *ppid) {
PHPAPI void php_session_reset_id(void) /* {{{ */
{
int module_number = PS(module_number);
- zval *sid;
+ zval *sid, *data, *ppid;
if (!PS(id)) {
php_error_docref(NULL, E_WARNING, "Cannot set session ID - session ID is not initialized");
@@ -1523,13 +1523,20 @@ PHPAPI void php_session_reset_id(void) /* {{{ */
}
}
- if (APPLY_TRANS_SID) {
- /* FIXME: Resetting vars are required when
- session is stop/start/regenerated. However,
- php_url_scanner_reset_vars() resets all vars
- including other URL rewrites set by elsewhere. */
- /* php_url_scanner_reset_vars(); */
- php_url_scanner_add_var(PS(session_name), strlen(PS(session_name)), ZSTR_VAL(PS(id)), ZSTR_LEN(PS(id)), 1);
+ /* Apply trans sid if sid cookie is not set */
+ if (APPLY_TRANS_SID
+ && (data = zend_hash_str_find(&EG(symbol_table), "_COOKIE", sizeof("_COOKIE") - 1))) {
+ ZVAL_DEREF(data);
+ if (Z_TYPE_P(data) == IS_ARRAY && (ppid = zend_hash_str_find(Z_ARRVAL_P(data), PS(session_name), strlen(PS(session_name))))) {
+ ZVAL_DEREF(ppid);
+ } else {
+ /* FIXME: Resetting vars are required when
+ session is stop/start/regenerated. However,
+ php_url_scanner_reset_vars() resets all vars
+ including other URL rewrites set by elsewhere. */
+ /* php_url_scanner_reset_vars(); */
+ php_url_scanner_add_var(PS(session_name), strlen(PS(session_name)), ZSTR_VAL(PS(id)), ZSTR_LEN(PS(id)), 1);
+ }
}
}
/* }}} */