Commit 21866322 authored by Robert Lyon's avatar Robert Lyon

Bug 1733722: Render session messages before calling templates

Problem on PHP 7.1 where messages were not being cleared

behatnotneeded

Change-Id: Ie6365c98b665a9b7271a9c748e4934e468ffa75f
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent 3dd6320f
......@@ -494,7 +494,8 @@ class Session {
*/
function insert_messages($placement='messages') {
global $SESSION;
return $SESSION->render_messages($placement);
$messages = $SESSION->render_messages($placement);
return (array($placement => $messages));
}
......
......@@ -884,6 +884,11 @@ EOF;
require_once('cookieconsent.php');
$smarty->assign('COOKIECONSENTCODE', get_cookieconsent_code());
}
// Render the session messages
$messages = array();
$messages = array_merge($messages, insert_messages('loginbox'));
$messages = array_merge($messages, insert_messages('messages'));
$smarty->assign('messages', $messages);
return $smarty;
}
......
......@@ -94,7 +94,7 @@
</div>
{/if}
{dynamic}{insert_messages}{/dynamic}
{dynamic}{$messages.messages|safe}{/dynamic}
{if $institutionselector}
<div class="institutionselector">
{$institutionselector|safe}
......
......@@ -9,7 +9,7 @@
</h3>
<div class="panel-body">
<noscript><p>{str tag="javascriptnotenabled"}</p></noscript>
{dynamic}{insert_messages placement='loginbox'}{/dynamic}
{dynamic}{$messages.loginbox|safe}{/dynamic}
<div id="loginform_container">
{$login_form|safe}
</div>
......
......@@ -5,7 +5,7 @@
</h3>
<div class="panel-body">
<noscript><p>{str tag="javascriptnotenabled"}</p></noscript>
{dynamic}{insert_messages placement='loginbox'}{/dynamic}
{dynamic}{$messages.loginbox|safe}{/dynamic}
<div id="loginform_container">{$sbdata.loginform|safe}</div>
</div>
</div>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment