com php-src: Fix brittle test: ext/session/tests/session_modu le_name_variation4.phpt
| From: | Christoph Michael Becker | Date: | Wed, 22 Jul 2020 18:45:56 +0000 |
| Subject: | com php-src: Fix brittle test: ext/session/tests/session_modu le_name_variation4.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-112325@lists.php.net to get a copy of this message | ||
Commit: 6b99a8be4d3adef95eece9e84395966694bb1cec
Author: Christoph M. Becker <cmbecker69@gmx.de> Wed, 22 Jul 2020 20:45:55 +0200
Parents: 2c0a6977ddd1c1306cd9b543c86dc90bb58013f0
Branches: PHP-7.3 PHP-7..4 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=6b99a8be4d3adef95eece9e84395966694bb1cec
Log:
Fix brittle test
This test fails occasionally due to timing issues, because the session
file may have been unlinked by the first
session_start()'s GC. We
adapt the test expectation to this reality.
Changed paths:
M ext/session/tests/session_module_name_variation4.phpt
Diff:
diff --git a/ext/session/tests/session_module_name_variation4.phpt
b/ext/session/tests/session_module_name_variation4.phpt
index 00e6975045..3ac731835f 100644
--- a/ext/session/tests/session_module_name_variation4.phpt
+++ b/ext/session/tests/session_module_name_variation4.phpt
@@ -29,10 +29,12 @@ $_SESSION["Blah"] = "Hello World!";
$_SESSION["Foo"] = FALSE;
$_SESSION["Guff"] = 1234567890;
var_dump($_SESSION);
+$oldsession = $_SESSION;
var_dump(session_write_close());
session_start();
-var_dump($_SESSION);
+// the session may have been GC'd or not; we accept either outcome
+var_dump($_SESSION === $oldsession || $_SESSION === []);
var_dump(session_destroy());
session_start();
var_dump($_SESSION);
@@ -51,14 +53,7 @@ array(3) {
int(1234567890)
}
bool(true)
-array(3) {
- ["Blah"]=>
- string(12) "Hello World!"
- ["Foo"]=>
- bool(false)
- ["Guff"]=>
- int(1234567890)
-}
+bool(true)
bool(true)
array(0) {
}