merged branch davefx/patch-1 (PR #7729)

This PR was merged into the master branch.

Discussion
----------

If cannot start session due to already-sent headers, show the file and line that have sent them

If session cannot be started because of already-sent headers, show the file and line from which the output has been started.

Commits
-------

00d2643 Showing file that has sent headers if cannot start session
This commit is contained in:
Fabien Potencier 2013-04-20 14:19:32 +02:00
commit b644232344

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