From cf78b84807708312de6fd8568a46c79573f10d68 Mon Sep 17 00:00:00 2001 From: Brad Jorsch Date: Fri, 15 Jun 2012 22:24:36 -0400 Subject: [PATCH] (bug 37643) Ensure a session is created when necessary for Captcha If the captcha data is going to be stored in the session, make sure the session has actually been started. Change-Id: Ia5eefdf738fad3fdbd305f1b3ce80dc86c66efe4 --- CaptchaStore.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CaptchaStore.php b/CaptchaStore.php index 3ab00b389..a54db97f8 100644 --- a/CaptchaStore.php +++ b/CaptchaStore.php @@ -59,6 +59,13 @@ abstract class CaptchaStore { class CaptchaSessionStore extends CaptchaStore { + protected function __construct() { + // Make sure the session is started + if ( session_id() === '' ) { + wfSetupSession(); + } + } + function store( $index, $info ) { $_SESSION['captcha' . $info['index']] = $info; }