24 foreach ( headers_list() as
$header ) {
26 $headers[strtolower( trim( $name ) )][] = trim(
$value );
29 if ( isset( $headers[
'set-cookie'] ) ) {
30 $cacheControl = isset( $headers[
'cache-control'] )
31 ? implode(
', ', $headers[
'cache-control'] )
34 if ( !preg_match(
'/(?:^|,)\s*(?:private|no-cache|no-store)\s*(?:$|,)/i',
37 header(
'Expires: Thu, 01 Jan 1970 00:00:00 GMT' );
38 header(
'Cache-Control: private, max-age=0, s-maxage=0' );
39 \MediaWiki\Logger\LoggerFactory::getInstance(
'cache-cookies' )->warning(
40 'Cookies set on {url} with Cache-Control "{cache-control}"', [
41 'url' => \WebRequest::getGlobalRequestURL(),
42 'cookies' => $headers[
'set-cookie'],
43 'cache-control' => $cacheControl ?:
'<not set>',
50 self::$headersSentException = new \Exception(
'Headers already sent from this point' );