Bug #73344 [NEW]: header() removes previously defined headers when replace flag is false

From: Date: Wed, 19 Oct 2016 04:59:02 +0000
Subject: Bug #73344 [NEW]: header() removes previously defined headers when replace flag is false
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-204908@lists.php.net to get a copy of this message
From: yohgaki Operating system: Irrelevant PHP version: Irrelevant Package: Unknown/Other Function Bug Type: Bug Bug description:header() removes previously defined headers when replace flag is false 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 -- Edit bug report at https://bugs.php.net/bug.php?id=73344&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=73344&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=73344&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=73344&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=73344&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=73344&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=73344&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=73344&r=needscript Try newer version: https://bugs.php.net/fix.php?id=73344&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=73344&r=support Expected behavior: https://bugs.php.net/fix.php?id=73344&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=73344&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=73344&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=73344&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=73344&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=73344&r=dst IIS Stability: https://bugs.php.net/fix.php?id=73344&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=73344&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=73344&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=73344&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=73344&r=mysqlcfg

« previous php.bugs (#204908) next »