From c1c0d243522d477799bb5ca325a100fa6a86a7fd Mon Sep 17 00:00:00 2001 From: Brad Jorsch Date: Tue, 16 Oct 2018 10:22:33 -0400 Subject: [PATCH] Add session_write_close() calls to SessionManager tests PHP 7.3 doesn't like it if session_id() is called when the session has been started, so we need to be sure to close it first in a few tests. Bug: T207112 Change-Id: Ief36c1bb7b5c9066f158b5bb0d6d785a7f7ddd3c (cherry picked from commit 6698b7ea1d63fbd2e3014bf563c3ad9e937bc8dd) --- tests/phpunit/includes/session/SessionBackendTest.php | 1 + tests/phpunit/includes/session/SessionManagerTest.php | 1 + 2 files changed, 2 insertions(+) diff --git a/tests/phpunit/includes/session/SessionBackendTest.php b/tests/phpunit/includes/session/SessionBackendTest.php index ae19278cb6..48c3d179e7 100644 --- a/tests/phpunit/includes/session/SessionBackendTest.php +++ b/tests/phpunit/includes/session/SessionBackendTest.php @@ -941,6 +941,7 @@ class SessionBackendTest extends MediaWikiTestCase { \Wikimedia\quietCall( 'session_start' ); $backend->unpersist(); $this->assertSame( self::SESSIONID . 'x', session_id() ); + session_write_close(); session_id( self::SESSIONID ); $wrap->persist = true; diff --git a/tests/phpunit/includes/session/SessionManagerTest.php b/tests/phpunit/includes/session/SessionManagerTest.php index e042f7655a..b33cd24a34 100644 --- a/tests/phpunit/includes/session/SessionManagerTest.php +++ b/tests/phpunit/includes/session/SessionManagerTest.php @@ -82,6 +82,7 @@ class SessionManagerTest extends MediaWikiTestCase { $context->setRequest( $request ); $id = $request->getSession()->getId(); + session_write_close(); session_id( '' ); $session = SessionManager::getGlobalSession(); $this->assertSame( $id, $session->getId() ); -- 2.20.1