Req #77758 [NEW]: Warning: headers already sent should identify what triggered the send
| From: | webmaster at jamescobban dot net | Date: | Sun, 17 Mar 2019 22:03:19 +0000 |
| Subject: | Req #77758 [NEW]: Warning: headers already sent should identify what triggered the send | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-220018@lists.php.net to get a copy of this message | ||
From: webmaster at jamescobban dot net
Operating system: linux
PHP version: 7.2.16
Package: Apache2 related
Bug Type: Feature/Change Request
Bug description:Warning: headers already sent should identify what triggered the send
Description:
------------
The message Warning: Cannot modify header information - headers already
sent is one of the big time-wasters of our profession. All of the
documentation on this message including hundreds of web-pages and forum
discussions end up as just a long list of things that the program MIGHT
have done that would cause this message to appear. There is no
documentation of exactly how a programmer should go about identifying
exactly what the, usually trivial, mistake was that triggered the early
send of the headers. The message should include information that
directly points at the program action that caused PHP to send the
headers.
Test script:
---------------
print ''; // empty string
header("Content-Type: application/json");
Expected result:
----------------
Warning: Cannot modify header information - headers already sent because
of backtrace to line 1.
Actual result:
--------------
Warning: Cannot modify header information - headers already sent at line
2.
--
Edit bug report at https://bugs.php.net/bug.php?id=77758&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=77758&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=77758&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=77758&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=77758&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=77758&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=77758&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=77758&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=77758&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=77758&r=support
Expected behavior: https://bugs.php.net/fix.php?id=77758&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=77758&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=77758&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=77758&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=77758&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=77758&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=77758&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=77758&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=77758&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=77758&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=77758&r=mysqlcfg