php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #72599 Different behavior from 7.0 and below with multiple session_start()s and output
Submitted: 2016-07-14 20:51 UTC Modified: 2016-08-27 06:50 UTC
From: peehaa@php.net Assigned:
Status: Wont fix Package: Session related
PHP Version: 7.1.0alpha3 OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: peehaa@php.net
New email:
PHP Version: OS:

 

 [2016-07-14 20:51 UTC] peehaa@php.net
Description:
------------
It seems like the behavior of starting a session has changed between < 7.1 and 7.1.

I'm not sure whether this is intentional (I couldn't find any mention of it in NEWS or UPGRADING or I just overlooked it).

When trying to start a session twice while the headers have already been sent I get:

Notice: A session had already been started - ignoring session_start() in /in/itgeJ on line 5

on the second session_start() call on 7.0 (and below), but on 7.1 I get:

Warning: session_start(): Cannot send session cookie - headers already sent by
Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /in/itgeJ:2) in /in/itgeJ on line 5

on the second session_start() call.

Test script: https://3v4l.org/NXiYR

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

session_start();
session_start();

Expected result:
----------------
Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /in/NXiYR:2) in /in/NXiYR on line 4

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /in/NXiYR:2) in /in/NXiYR on line 4

Notice: A session had already been started - ignoring session_start() in /in/NXiYR on line 5

Actual result:
--------------
output

Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /in/NXiYR:2) in /in/NXiYR on line 4

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /in/NXiYR:2) in /in/NXiYR on line 4

Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /in/NXiYR:2) in /in/NXiYR on line 5

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /in/NXiYR:2) in /in/NXiYR on line 5

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-08-27 06:50 UTC] yohgaki@php.net
-Status: Open +Status: Wont fix
 [2016-08-27 06:50 UTC] yohgaki@php.net
Behavior would not be fixed because starting session when it is impossible to start correctly is a bug of session manager. i.e. There is no point running script with unusable $_SESSION array.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 16:01:29 2024 UTC