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