com php-src: Fixed bug #72940 SID always return "name=ID" , even if session cookie exist: NEWS ext/sess ion/session.c ext/session/tests/bug72940.phpt
| From: | Yasuo Ohgaki | Date: | Tue, 30 Aug 2016 06:58:25 +0000 |
| Subject: | com php-src: Fixed bug #72940 SID always return "name=ID" , even if session cookie exist: NEWS ext/sess ion/session.c ext/session/tests/bug72940.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-94145@lists.php.net to get a copy of this message | ||
Commit: b5f2f6fbd802ad3bc4fb37185e9e776bb089db56
Author: Yasuo Ohgaki <yohgaki@php.net> Tue, 30 Aug 2016 15:56:06 +0900
Parents: 65f0c163f929e48162efc3491fee918bb5c4c280
Branches: PHP-7.0 PHP-7.1 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=b5f2f6fbd802ad3bc4fb37185e9e776bb089db56
Log:
Fixed bug #72940 SID always return "name=ID", even if session cookie exist
Bugs:
https://bugs.php.net/72940
Changed paths:
M NEWS
M ext/session/session.c
A ext/session/tests/bug72940.phpt
Diff:
diff --git a/NEWS b/NEWS
index 198af3c..3bc47ec 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 8e5caf9..a47e78c 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 0000000..5f3c790
--- /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"