Add session_write_close() calls to SessionManager tests
authorBrad Jorsch <bjorsch@wikimedia.org>
Tue, 16 Oct 2018 14:22:33 +0000 (10:22 -0400)
committerLegoktm <legoktm@member.fsf.org>
Tue, 16 Oct 2018 16:11:44 +0000 (16:11 +0000)
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
tests/phpunit/includes/session/SessionManagerTest.php

index ae19278..48c3d17 100644 (file)
@@ -941,6 +941,7 @@ class SessionBackendTest extends MediaWikiTestCase {
                \Wikimedia\quietCall( 'session_start' );
                $backend->unpersist();
                $this->assertSame( self::SESSIONID . 'x', session_id() );
                \Wikimedia\quietCall( 'session_start' );
                $backend->unpersist();
                $this->assertSame( self::SESSIONID . 'x', session_id() );
+               session_write_close();
 
                session_id( self::SESSIONID );
                $wrap->persist = true;
 
                session_id( self::SESSIONID );
                $wrap->persist = true;
index e042f76..b33cd24 100644 (file)
@@ -82,6 +82,7 @@ class SessionManagerTest extends MediaWikiTestCase {
                $context->setRequest( $request );
                $id = $request->getSession()->getId();
 
                $context->setRequest( $request );
                $id = $request->getSession()->getId();
 
+               session_write_close();
                session_id( '' );
                $session = SessionManager::getGlobalSession();
                $this->assertSame( $id, $session->getId() );
                session_id( '' );
                $session = SessionManager::getGlobalSession();
                $this->assertSame( $id, $session->getId() );