summaryrefslogtreecommitdiff
path: root/ext/session/tests
diff options
context:
space:
mode:
authorChristoph M. Becker <cmbecker69@gmx.de>2020-03-26 19:01:33 +0100
committerChristoph M. Becker <cmbecker69@gmx.de>2020-03-31 08:38:23 +0200
commitb510250b8ebe9d90b1db150d7a1edc75893f2e48 (patch)
tree3adfd3eab317f4490d455d786a31dbfb855b5bfd /ext/session/tests
parenta681b12820ee1556668087bc7866006ca5329635 (diff)
downloadphp-git-b510250b8ebe9d90b1db150d7a1edc75893f2e48.tar.gz
Fix #79413: session_create_id() fails for active sessions
The comment on `PS_VALIDATE_SID_FUNC(files)` is very clear that the function is supposed to return `SUCCESS` if the session already exists. So to detect a collision, we have to check for `SUCCESS`, not `FAILURE`. We also fix the wrong condition in session_regenerate_id() as well.
Diffstat (limited to 'ext/session/tests')
-rw-r--r--ext/session/tests/bug79091.phpt2
-rw-r--r--ext/session/tests/bug79413.phpt15
2 files changed, 16 insertions, 1 deletions
diff --git a/ext/session/tests/bug79091.phpt b/ext/session/tests/bug79091.phpt
index 1d14427159..4d60e69872 100644
--- a/ext/session/tests/bug79091.phpt
+++ b/ext/session/tests/bug79091.phpt
@@ -50,7 +50,7 @@ class MySessionHandler implements SessionHandlerInterface, SessionIdInterface, S
public function validateId($key)
{
- return false;
+ return true;
}
}
diff --git a/ext/session/tests/bug79413.phpt b/ext/session/tests/bug79413.phpt
new file mode 100644
index 0000000000..756b29f6ea
--- /dev/null
+++ b/ext/session/tests/bug79413.phpt
@@ -0,0 +1,15 @@
+--TEST--
+Bug #79413 (session_create_id() fails for active sessions)
+--SKIPIF--
+<?php
+if (!extension_loaded('session')) die('skip session extension not available');
+?>
+--FILE--
+<?php
+session_start();
+$old = session_id();
+$new = session_create_id();
+var_dump($new !== $old);
+?>
+--EXPECT--
+bool(true)