Showing file that has sent headers if cannot start session

If session cannot be started because of already-sent headers, show the file and line from which the output has been started.
This commit is contained in:
David Marín 2013-04-20 12:51:05 +03:00
parent 5762b5e1d2
commit 00d2643540

View File

@ -140,8 +140,8 @@ class NativeSessionStorage implements SessionStorageInterface
throw new \RuntimeException('Failed to start the session: already started by PHP ($_SESSION is set).');
}
if (ini_get('session.use_cookies') && headers_sent()) {
throw new \RuntimeException('Failed to start the session because headers have already been sent.');
if (ini_get('session.use_cookies') && headers_sent($headers_sent_file, $headers_sent_line_number)) {
throw new \RuntimeException('Failed to start the session because headers have already been sent by '.$headers_sent_file.':'.$headers_sent_line_number.'.');
}
// ok to try and start the session