]> granicus.if.org Git - php/commitdiff
Fixed bug #72940 SID always return "name=ID", even if session cookie exist
authorYasuo Ohgaki <yohgaki@php.net>
Tue, 30 Aug 2016 06:56:06 +0000 (15:56 +0900)
committerYasuo Ohgaki <yohgaki@php.net>
Tue, 30 Aug 2016 06:58:25 +0000 (15:58 +0900)
NEWS
ext/session/session.c
ext/session/tests/bug72940.phpt [new file with mode: 0644]

diff --git a/NEWS b/NEWS
index 198af3ce26d1a22d86e205b46ca96ca8d72e2f2b..3bc47ecd4d38dfb5cf4a9aacf4b14c699ad06cb7 100644 (file)
--- 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
index 8e5caf9bb33687d152b5dcc980287894a6bf31cb..a47e78cdb2184fc691c1f66e3fa16d95f78e6745 100644 (file)
@@ -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 (file)
index 0000000..5f3c790
--- /dev/null
@@ -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"