Skip to content

Commit 9d631d0

Browse files
Apply PR feedback
1 parent 3ff1b41 commit 9d631d0

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

core/Session.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,25 @@ public static function getSameSiteCookieValue()
180180

181181
$isOptOutRequest = $module == 'CoreAdminHome' && ($action == 'optOut' || $action == 'optOutJS');
182182
$shouldUseNone = !empty($general['enable_framed_pages']) || $isOptOutRequest || Overlay::isOverlayRequest($module, $action, $method, $referer);
183+
/** @var bool $shouldUseNoneForcefully */
183184
$shouldUseNoneForcefully = false;
185+
/**
186+
* Triggered to determine whether the session cookie SameSite value should be forced to None.
187+
*
188+
* Plugins can set `$shouldUseNoneForcefully` to true when the session cookie needs to be
189+
* sent in a third-party context that is not covered by Matomo's built-in iframe, opt-out,
190+
* or Overlay detection. The final cookie value is still only set to `None` when the request
191+
* is served over HTTPS.
192+
*
193+
* @param bool &$shouldUseNoneForcefully Set this to true to force the session cookie SameSite value to None.
194+
*
195+
* @internal
196+
*
197+
* @example
198+
* Piwik::addAction('Session.shouldSendSameSiteCookieAsNoneForcefully', function (&$shouldUseNoneForcefully) {
199+
* $shouldUseNoneForcefully = true;
200+
* });
201+
*/
184202
Piwik::postEvent('Session.shouldSendSameSiteCookieAsNoneForcefully', [&$shouldUseNoneForcefully]);
185203

186204
// @phpstan-ignore-next-line value may be changed by plugin listeners via reference

0 commit comments

Comments
 (0)