From b5f2f6fbd802ad3bc4fb37185e9e776bb089db56 Mon Sep 17 00:00:00 2001 From: Yasuo Ohgaki Date: Tue, 30 Aug 2016 15:56:06 +0900 Subject: [PATCH] Fixed bug #72940 SID always return "name=ID", even if session cookie exist --- NEWS | 2 ++ ext/session/session.c | 1 + ext/session/tests/bug72940.phpt | 35 +++++++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+) create mode 100644 ext/session/tests/bug72940.phpt 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-- + +--COOKIE-- +PHPSESSID=bug72940test +--GET-- +PHPSESSID=bug72940get +--FILE-- + +--EXPECTF-- +string(12) "bug72940test" +string(0) "" +string(11) "bug72940get" +string(21) "PHPSESSID=bug72940get" -- 2.40.0