php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #73344 header() removes previously defined headers when replace flag is false
Submitted: 2016-10-19 04:58 UTC Modified: 2016-10-19 05:27 UTC
From: yohgaki@php.net Assigned: yohgaki (profile)
Status: Not a bug Package: Unknown/Other Function
PHP Version: Irrelevant OS: Irrelevant
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: yohgaki@php.net
New email:
PHP Version: OS:

 

 [2016-10-19 04:58 UTC] yohgaki@php.net
Description:
------------
header() removes previously defined headers when replace flag is false.

Test script:
---------------
<?php
ob_start();

ini_set('session.use_cookies', 1);
ini_set('session.save_handler', 'files');

session_name('BUG');
session_start();

// Bug0
session_regenerate_id(true);

// Bug2
header(sprintf('Set-Cookie: BUG=BUG2; expires=Sat, 03-Sep-2020 05:38:43 GMT; path=/;', false));


Expected result:
----------------
$ ./sapi/cgi/php-cgi s.php
X-Powered-By: PHP/5.6.28-dev
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Set-Cookie: BUG=45df8aabbae8b88139fefdc46c2de696; path=/
Set-Cookie: BUG=BUG2; expires=Sat, 03-Sep-2020 05:38:43 GMT; path=/;
Content-type: text/html; charset=UTF-8


Actual result:
--------------
$ ./sapi/cgi/php-cgi s.php
X-Powered-By: PHP/5.6.28-dev
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Set-Cookie: BUG=BUG2; expires=Sat, 03-Sep-2020 05:38:43 GMT; path=/;
Content-type: text/html; charset=UTF-8


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-10-19 04:59 UTC] yohgaki@php.net
-Assigned To: +Assigned To: yohgaki
 [2016-10-19 05:27 UTC] yohgaki@php.net
-Status: Assigned +Status: Not a bug
 [2016-10-19 05:27 UTC] yohgaki@php.net
There was bug in script. Remove flag works fine.
I should have removed needless sprintf().
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 10:01:29 2024 UTC