Bug #74941 [Com]: Session fails to start after having headers sent
| From: | wapinet at mail dot ru | Date: | Sat, 26 Aug 2017 03:17:16 +0000 |
| Subject: | Bug #74941 [Com]: Session fails to start after having headers sent | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-210824@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=74941&edit=1
ID: 74941
Comment by: wapinet at mail dot ru
Reported by: smorozov at sugarcrm dot com
Summary: Session fails to start after having headers sent
Status: Closed
Type: Bug
Package: Session related
Operating System: Linux
PHP Version: 7.2.0alpha3
Block user comment: N
Private report: N
New Comment:
need to backport to the branch 7.1
Previous Comments:
------------------------------------------------------------------------
[2017-07-20 06:54:48] 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:00] 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-17 14:24:48] 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
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=74941&edit=1