Commit: 16411586449c7562b840d6226f6ef55f567c35f3
Author: Yasuo Ohgaki <yohg...@php.net> Wed, 21 Aug 2013 08:08:55
+0900
Parents: 268c2884fa4a0e61ecf35712d6472c41a9023197
Branches: PHP-5.5
Link:
http://git.php.net/?p=php-src.git;a=commitdiff;h=16411586449c7562b840d6226f6ef55f567c35f3
Log:
Fixed Bug #65475
Bugs:
https://bugs.php.net/65475
Changed paths:
M ext/session/mod_files.c
M ext/session/mod_mm.c
A ext/session/tests/bug65475.phpt
M ext/session/tests/rfc1867.phpt
M ext/session/tests/rfc1867_cleanup.phpt
M ext/session/tests/rfc1867_disabled.phpt
M ext/session/tests/rfc1867_disabled_2.phpt
M ext/session/tests/rfc1867_inter.phpt
M ext/session/tests/rfc1867_no_name.phpt
M ext/session/tests/rfc1867_sid_cookie.phpt
M ext/session/tests/rfc1867_sid_get.phpt
M ext/session/tests/rfc1867_sid_get_2.phpt
M ext/session/tests/rfc1867_sid_only_cookie.phpt
M ext/session/tests/rfc1867_sid_post.phpt
M ext/session/tests/session_id_basic.phpt
diff --git a/ext/session/mod_files.c b/ext/session/mod_files.c
index e5733b4..004d9d4 100644
--- a/ext/session/mod_files.c
+++ b/ext/session/mod_files.c
@@ -338,13 +338,13 @@ PS_READ_FUNC(files)
if (!PS(id)) {
return FAILURE;
}
- php_session_reset_id(TSRMLS_C);
if (PS(use_cookies)) {
PS(send_cookie) = 1;
}
+ php_session_reset_id(TSRMLS_C);
}
- ps_files_open(data, key TSRMLS_CC);
+ ps_files_open(data, PS(id) TSRMLS_CC);
if (data->fd < 0) {
return FAILURE;
}
diff --git a/ext/session/mod_mm.c b/ext/session/mod_mm.c
index 69c0da7..3d37b98 100644
--- a/ext/session/mod_mm.c
+++ b/ext/session/mod_mm.c
@@ -367,13 +367,13 @@ PS_READ_FUNC(mm)
if (!PS(id)) {
return FAILURE;
}
- php_session_reset_id(TSRMLS_C);
if (PS(use_cookies)) {
PS(send_cookie) = 1;
}
+ php_session_reset_id(TSRMLS_C);
}
- sd = ps_sd_lookup(data, key, 0);
+ sd = ps_sd_lookup(data, PS(id), 0);
if (sd) {
*vallen = sd->datalen;
*val = emalloc(sd->datalen + 1);
diff --git a/ext/session/tests/bug65475.phpt b/ext/session/tests/bug65475.phpt
new file mode 100644
index 0000000..7dc5463
--- /dev/null
+++ b/ext/session/tests/bug65475.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Bug #65475: Session ID is not initialized when session.usr_strict_mode=1
+--INI--
+session.save_handler=files
+session.name=PHPSESSID
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+ob_start();
+
+echo "Testing file module".PHP_EOL;
+session_start();
+$_SESSION['foo'] = 1234;
+$_SESSION['cnt'] = 1;
+$session_id = session_id();
+session_write_close();
+
+session_start();
+var_dump($session_id === session_id());
+$_SESSION['cnt']++;
+session_write_close();
+
+session_start();
+var_dump($session_id === session_id());
+var_dump($_SESSION['cnt']); // Should be int(2)
+session_write_close();
+
+--EXPECTF--
+Testing file module
+bool(true)
+bool(true)
+int(2)
+
diff --git a/ext/session/tests/rfc1867.phpt b/ext/session/tests/rfc1867.phpt
index dc44e8b..6b14bcb 100644
--- a/ext/session/tests/rfc1867.phpt
+++ b/ext/session/tests/rfc1867.phpt
@@ -7,6 +7,7 @@ comment=debug builds show some additional E_NOTICE errors
upload_max_filesize=1024
session.save_path=
session.name=PHPSESSID
+session.use_strict_mode=0
session.use_cookies=1
session.use_only_cookies=0
session.upload_progress.enabled=1
diff --git a/ext/session/tests/rfc1867_cleanup.phpt
b/ext/session/tests/rfc1867_cleanup.phpt
index f70b395..f84385b 100644
--- a/ext/session/tests/rfc1867_cleanup.phpt
+++ b/ext/session/tests/rfc1867_cleanup.phpt
@@ -7,6 +7,7 @@ comment=debug builds show some additional E_NOTICE errors
upload_max_filesize=1024
session.save_path=
session.name=PHPSESSID
+session.use_strict_mode=0
session.use_cookies=1
session.use_only_cookies=0
session.upload_progress.enabled=1
diff --git a/ext/session/tests/rfc1867_disabled.phpt
b/ext/session/tests/rfc1867_disabled.phpt
index 4490055..550ee3a 100644
--- a/ext/session/tests/rfc1867_disabled.phpt
+++ b/ext/session/tests/rfc1867_disabled.phpt
@@ -7,6 +7,7 @@ comment=debug builds show some additional E_NOTICE errors
upload_max_filesize=1024
session.save_path=
session.name=PHPSESSID
+session.use_strict_mode=0
session.use_cookies=1
session.use_only_cookies=0
session.upload_progress.enabled=0
diff --git a/ext/session/tests/rfc1867_disabled_2.phpt
b/ext/session/tests/rfc1867_disabled_2.phpt
index e878f46..83e97ee 100644
--- a/ext/session/tests/rfc1867_disabled_2.phpt
+++ b/ext/session/tests/rfc1867_disabled_2.phpt
@@ -7,6 +7,7 @@ comment=debug builds show some additional E_NOTICE errors
upload_max_filesize=1024
session.save_path=
session.name=PHPSESSID
+session.use_strict_mode=0
session.use_cookies=1
session.use_only_cookies=0
session.upload_progress.enabled=1
diff --git a/ext/session/tests/rfc1867_inter.phpt
b/ext/session/tests/rfc1867_inter.phpt
index 7686371..4d9b262 100644
--- a/ext/session/tests/rfc1867_inter.phpt
+++ b/ext/session/tests/rfc1867_inter.phpt
@@ -7,6 +7,7 @@ comment=debug builds show some additional E_NOTICE errors
upload_max_filesize=1024
session.save_path=
session.name=PHPSESSID
+session.use_strict_mode=0
session.use_cookies=1
session.use_only_cookies=0
session.upload_progress.enabled=1
diff --git a/ext/session/tests/rfc1867_no_name.phpt
b/ext/session/tests/rfc1867_no_name.phpt
index c1dda81..d68a61d 100644
--- a/ext/session/tests/rfc1867_no_name.phpt
+++ b/ext/session/tests/rfc1867_no_name.phpt
@@ -7,6 +7,7 @@ comment=debug builds show some additional E_NOTICE errors
upload_max_filesize=1024
session.save_path=
session.name=PHPSESSID
+session.use_strict_mode=0
session.use_cookies=1
session.use_only_cookies=0
session.upload_progress.enabled=1
diff --git a/ext/session/tests/rfc1867_sid_cookie.phpt
b/ext/session/tests/rfc1867_sid_cookie.phpt
index 735a5ac..2864799 100644
--- a/ext/session/tests/rfc1867_sid_cookie.phpt
+++ b/ext/session/tests/rfc1867_sid_cookie.phpt
@@ -7,6 +7,7 @@ comment=debug builds show some additional E_NOTICE errors
upload_max_filesize=1024
session.save_path=
session.name=PHPSESSID
+session.use_strict_mode=0
session.use_cookies=1
session.use_only_cookies=0
session.upload_progress.enabled=1
diff --git a/ext/session/tests/rfc1867_sid_get.phpt
b/ext/session/tests/rfc1867_sid_get.phpt
index cc5a793..e3a48a1 100644
--- a/ext/session/tests/rfc1867_sid_get.phpt
+++ b/ext/session/tests/rfc1867_sid_get.phpt
@@ -7,6 +7,7 @@ comment=debug builds show some additional E_NOTICE errors
upload_max_filesize=1024
session.save_path=
session.name=PHPSESSID
+session.use_strict_mode=0
session.use_cookies=1
session.use_only_cookies=0
session.upload_progress.enabled=1
diff --git a/ext/session/tests/rfc1867_sid_get_2.phpt
b/ext/session/tests/rfc1867_sid_get_2.phpt
index 1d22e59..e21ca4c 100644
--- a/ext/session/tests/rfc1867_sid_get_2.phpt
+++ b/ext/session/tests/rfc1867_sid_get_2.phpt
@@ -7,6 +7,7 @@ comment=debug builds show some additional E_NOTICE errors
upload_max_filesize=1024
session.save_path=
session.name=PHPSESSID
+session.use_strict_mode=0
session.use_cookies=0
session.use_only_cookies=0
session.upload_progress.enabled=1
diff --git a/ext/session/tests/rfc1867_sid_only_cookie.phpt
b/ext/session/tests/rfc1867_sid_only_cookie.phpt
index 9a01056..41f6761 100644
--- a/ext/session/tests/rfc1867_sid_only_cookie.phpt
+++ b/ext/session/tests/rfc1867_sid_only_cookie.phpt
@@ -7,6 +7,7 @@ comment=debug builds show some additional E_NOTICE errors
upload_max_filesize=1024
session.save_path=
session.name=PHPSESSID
+session.use_strict_mode=0
session.use_cookies=1
session.use_only_cookies=1
session.upload_progress.enabled=1
diff --git a/ext/session/tests/rfc1867_sid_post.phpt
b/ext/session/tests/rfc1867_sid_post.phpt
index 7c1eb2d..107957f 100644
--- a/ext/session/tests/rfc1867_sid_post.phpt
+++ b/ext/session/tests/rfc1867_sid_post.phpt
@@ -7,6 +7,7 @@ comment=debug builds show some additional E_NOTICE errors
upload_max_filesize=1024
session.save_path=
session.name=PHPSESSID
+session.use_strict_mode=0
session.use_cookies=1
session.use_only_cookies=0
session.upload_progress.enabled=1
diff --git a/ext/session/tests/session_id_basic.phpt
b/ext/session/tests/session_id_basic.phpt
index 5cb13c2..852d2f9 100644
--- a/ext/session/tests/session_id_basic.phpt
+++ b/ext/session/tests/session_id_basic.phpt
@@ -20,6 +20,8 @@ var_dump(session_id("test"));
var_dump(session_id());
var_dump(session_id("1234567890"));
var_dump(session_id());
+// Turn off strice mode, since it does not allow uninitialized session ID
+ini_set('session.use_strict_mode',false);
var_dump(session_start());
var_dump(session_id());
var_dump(session_destroy());
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php