Edit report at https://bugs.php.net/bug.php?id=42197&edit=1
ID: 42197
Updated by: yohgaki@php.net
Reported by: cweiske@php.net
Summary: header() cannot be used after echo on CLI
Status: Open
Type: Feature/Change Request
Package: *General Issues
Operating System: Linux
PHP Version: 5.2.4RC1
Block user comment: N
Private report: N
New Comment:
BTW, I cannot remove header() from CLI. CLI has built-in web server now.
Previous Comments:
------------------------------------------------------------------------
[2015-01-12 20:27:24] yohgaki@php.net
Header cannot be sent if body is sent already. It's the definition of HTTP. I fail to see
what's wrong with this.
Besides, what the reason you need to call header() with CLI other than testing?
------------------------------------------------------------------------
[2015-01-12 19:57:39] aharvey@php.net
I'm confused: isn't it a _good_ thing that the CLI behaves the same way as other SAPIs in
terms of header() handling for testing?
------------------------------------------------------------------------
[2015-01-10 13:21:46] cweiske@php.net
@ajf: Not, those are not better questions.
If you had read the bug report description, you'd have noticed that I run unit tests which run
code that uses header(). 14 plus votes do also stand against your "better question".
------------------------------------------------------------------------
[2015-01-09 00:52:23] ajf@php.net
Perhaps a better question is why header() is even available on CLI, or why you're using it in
CLI.
------------------------------------------------------------------------
[2014-05-02 12:54:46] mijahn dot ben at gmail dot com
Output buffering impedes the ability to view line by line errors when CLI unit testing.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=42197
--
Edit this bug report at https://bugs.php.net/bug.php?id=42197&edit=1