Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions symphony/lib/toolkit/class.frontendpage.php
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,20 @@ private function processEvents($events, XMLElement &$wrapper)

foreach ($events as $handle) {
$pool[$handle] = EventManager::create($handle, array('env' => $this->_env, 'param' => $this->_param));
// Make sure that filters requiring XSRF token to work are getting a valid XSRF token.
// We do not always create it, because that would create useless sessions
if (
Symphony::isXSRFEnabled() && !XSRF::getSessionToken() &&
isset($pool[$handle]->eParamFILTERS) &&
is_array($pool[$handle]->eParamFILTERS)
) {
$xsrfFilters = array_filter($pool[$handle]->eParamFILTERS, function ($filter) {
return strpos($filter, 'xsrf') !== false;
});
if (!empty($xsrfFilters)) {
$this->_param['cookie-xsrf-token'] = XSRF::getToken();
}
}
}

uasort($pool, array($this, '__findEventOrder'));
Expand Down