Commit b12f4dd7 by Alexander Makarov

Fixes #3956: Debug toolbar was affecting flash message removal

parent 517cf3df
......@@ -5,6 +5,7 @@ Yii Framework 2 debug extension Change Log
--------------------------
- Bug #1263: Fixed the issue that Gii and Debug modules might be affected by incompatible asset manager configuration (qiangxue)
- Bug #3956: Debug toolbar was affecting flash message removal (samdark)
- Enh #2299: Date and time in request list is now never wrapped (samdark)
- Enh #3088: The debug module will manage their own URL rules now (qiangxue)
- Enh #3103: debugger panel is now not displayed when printing a page (githubjeka)
......
......@@ -85,11 +85,9 @@ class RequestPanel extends Panel
} else {
$action = null;
}
/** @var \yii\web\Session $session */
$session = Yii::$app->has('session', true) ? Yii::$app->get('session') : null;
return [
'flashes' => $session ? $session->getAllFlashes() : [],
'flashes' => $this->getFlashes(),
'statusCode' => Yii::$app->getResponse()->getStatusCode(),
'requestHeaders' => $requestHeaders,
'responseHeaders' => $responseHeaders,
......@@ -109,4 +107,27 @@ class RequestPanel extends Panel
'SESSION' => empty($_SESSION) ? [] : $_SESSION,
];
}
/**
* Getting flash messages without deleting them or touching deletion counters
*
* @return array flash messages (key => message).
*/
protected function getFlashes()
{
/** @var \yii\web\Session $session */
$session = Yii::$app->has('session', true) ? Yii::$app->get('session') : null;
if ($session === null) {
return [];
}
$counters = $session->get($session->flashParam, []);
$flashes = [];
foreach (array_keys($counters) as $key) {
if (array_key_exists($key, $_SESSION)) {
$flashes[$key] = $_SESSION[$key];
}
}
return $flashes;
}
}
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