summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYasuo Ohgaki <yohgaki@php.net>2016-08-30 15:56:06 +0900
committerYasuo Ohgaki <yohgaki@php.net>2016-08-30 15:58:25 +0900
commitb5f2f6fbd802ad3bc4fb37185e9e776bb089db56 (patch)
tree19ac46ee4da114f6444745cc6cfc7ac0ede9f77d
parent65f0c163f929e48162efc3491fee918bb5c4c280 (diff)
downloadphp-git-b5f2f6fbd802ad3bc4fb37185e9e776bb089db56.tar.gz
Fixed bug #72940 SID always return "name=ID", even if session cookie exist
-rw-r--r--NEWS2
-rw-r--r--ext/session/session.c1
-rw-r--r--ext/session/tests/bug72940.phpt35
3 files changed, 38 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index 198af3ce26..3bc47ecd4d 100644
--- a/NEWS
+++ b/NEWS
@@ -73,6 +73,8 @@ PHP NEWS
- Session:
. Fixed bug #72724 (PHP7: session-uploadprogress kills httpd). (Nikita)
+ . Fixed bug #72940 (SID always return "name=ID", even if session
+ cookie exist). (Yasuo)
- Standard:
. Fixed bug #55451 (substr_compare NULL length interpreted as 0). (Lauri
diff --git a/ext/session/session.c b/ext/session/session.c
index 8e5caf9bb3..a47e78cdb2 100644
--- a/ext/session/session.c
+++ b/ext/session/session.c
@@ -1633,6 +1633,7 @@ PHPAPI void php_session_start(void) /* {{{ */
if (Z_TYPE_P(data) == IS_ARRAY && (ppid = zend_hash_str_find(Z_ARRVAL_P(data), PS(session_name), lensess))) {
ppid2sid(ppid);
PS(send_cookie) = 0;
+ PS(define_sid) = 0;
}
}
diff --git a/ext/session/tests/bug72940.phpt b/ext/session/tests/bug72940.phpt
new file mode 100644
index 0000000000..5f3c790405
--- /dev/null
+++ b/ext/session/tests/bug72940.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Bug #72940 - SID always defined
+--INI--
+error_reporting=-1
+session.save_path=
+session.name=PHPSESSID
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--COOKIE--
+PHPSESSID=bug72940test
+--GET--
+PHPSESSID=bug72940get
+--FILE--
+<?php
+ob_start();
+
+ini_set('session.use_strict_mode', 0);
+ini_set('session.use_cookies', 1);
+ini_set('session.use_only_cookies', 0);
+session_start();
+var_dump(session_id(), SID);
+session_destroy();
+
+ini_set('session.use_strict_mode', 0);
+ini_set('session.use_cookies', 0);
+ini_set('session.use_only_cookies', 0);
+session_start();
+var_dump(session_id(), SID);
+session_destroy();
+?>
+--EXPECTF--
+string(12) "bug72940test"
+string(0) ""
+string(11) "bug72940get"
+string(21) "PHPSESSID=bug72940get"