From adc33ddf93c65070acc4fbad70cff087afaf77ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20T=C3=B3th?= Date: Wed, 31 Jul 2019 17:07:20 +0200 Subject: [PATCH] Fix header warnings from log flushing Fixes simplesamlphp/simplesamlphp#1168 --- lib/SimpleSAML/Logger.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/SimpleSAML/Logger.php b/lib/SimpleSAML/Logger.php index ba193eae84..c2dbfe1098 100644 --- a/lib/SimpleSAML/Logger.php +++ b/lib/SimpleSAML/Logger.php @@ -371,8 +371,13 @@ public static function popErrorMask() */ private static function defer($level, $message, $stats) { + // so that the headers are not sent by flush + \SimpleSAML\Session::getSessionFromRequest(); + // save the message for later - self::$earlyLog[] = ['level' => $level, 'string' => $message, 'statsLog' => $stats]; + self::$earlyLog[] = [ + 'level' => $level, 'string' => $message, 'statsLog' => $stats + ]; // register a shutdown handler if needed if (!self::$shutdownRegistered) {