php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75227 You cannot change the session module's ini settings at this time
Submitted: 2017-09-19 13:50 UTC Modified: 2017-09-19 14:43 UTC
From: k dot michalak at kstudio dot pl Assigned:
Status: Not a bug Package: Session related
PHP Version: 7.2.0RC2 OS: Debian
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: k dot michalak at kstudio dot pl
New email:
PHP Version: OS:

 

 [2017-09-19 13:50 UTC] k dot michalak at kstudio dot pl
Description:
------------
We cannot change session settings after header send

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

echo "OK";

ini_set('session.use_cookies', 0);


Expected result:
----------------
OK

Actual result:
--------------
OK
Warning: ini_set(): Headers already sent. You cannot change the session module's ini settings at this time in /home/test/test020.php on line 5

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-09-19 13:55 UTC] requinix@php.net
-Status: Open +Status: Feedback
 [2017-09-19 13:55 UTC] requinix@php.net
That's right, you can't change session settings after headers have been sent.

Why do you think this is a bug?
 [2017-09-19 14:32 UTC] k dot michalak at kstudio dot pl
But in php 7.0.22 thereis no problem
 [2017-09-19 14:43 UTC] requinix@php.net
-Status: Feedback +Status: Not a bug
 [2017-09-19 14:43 UTC] requinix@php.net
The new error messages were added in relation to bug #71038.

There may not have been an error in 7.0.22 but the code would not have worked correctly: you simply cannot change most, if not all, session information after output has begun.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jan 29 19:02:32 2025 UTC