Bug #74941 [NEW]: Session fails to start after having headers sent
| From: | smorozov at sugarcrm dot com | Date: | Mon, 17 Jul 2017 14:24:50 +0000 |
| Subject: | Bug #74941 [NEW]: Session fails to start after having headers sent | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-210089@lists.php.net to get a copy of this message | ||
From: smorozov at sugarcrm dot com
Operating system: Linux
PHP version: 7.2.0alpha3
Package: Session related
Bug Type: Bug
Bug description:Session fails to start after having headers sent
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 bug report at https://bugs.php.net/bug.php?id=74941&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=74941&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=74941&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=74941&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=74941&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=74941&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=74941&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=74941&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=74941&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=74941&r=support
Expected behavior: https://bugs.php.net/fix.php?id=74941&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=74941&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=74941&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=74941&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74941&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=74941&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=74941&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=74941&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=74941&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=74941&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=74941&r=mysqlcfg