php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74941 Session fails to start after having headers sent
Submitted: 2017-07-17 14:24 UTC Modified: -
From: smorozov at sugarcrm dot com Assigned:
Status: Closed Package: Session related
PHP Version: 7.2.0alpha3 OS: Linux
Private report: No CVE-ID: None
 [2017-07-17 14:24 UTC] smorozov at sugarcrm dot com
Description:
------------
If a session start is not supposed to output any headers, it should not fail in the case if response headers have been already sent.

The script below works on PHP 7.1 and older versions but doesn't work on PHP 7.2.

The same happens when calling session_id($id) before session_start().

Seems similar to #55267.

Test script:
---------------
<?php

ini_set('session.use_cookies', false);
ini_set('session.cache_limiter', false);

echo '.';

session_start();


Expected result:
----------------
No warning triggered.

Actual result:
--------------
Warning: session_start(): Cannot start session when headers already sent in test.php on line 8

Call Stack:
    0.0001     397720   1. {main}() test.php:0
    0.0001     398128   2. session_start() test.php:8


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-07-20 06:53 UTC] krakjoe@php.net
Automatic comment on behalf of morozov@tut.by
Revision: http://git.php.net/?p=php-src.git;a=commit;h=9b9184a45a015a69d39fe88eebd93e14b575afc4
Log: Fixed bug #74941 - Session fails to start after having headers sent
 [2017-07-20 06:53 UTC] krakjoe@php.net
-Status: Open +Status: Closed
 [2017-07-20 06:54 UTC] krakjoe@php.net
Automatic comment on behalf of morozov@tut.by
Revision: http://git.php.net/?p=php-src.git;a=commit;h=9b9184a45a015a69d39fe88eebd93e14b575afc4
Log: Fixed bug #74941 - Session fails to start after having headers sent
 [2017-08-26 03:17 UTC] wapinet at mail dot ru
need to backport to the branch 7.1
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC