Req #42197 [Opn]: header() cannot be used after echo on CLI
| From: | aharvey@php.net | Date: | Mon, 12 Jan 2015 19:57:40 +0000 |
| Subject: | Req #42197 [Opn]: header() cannot be used after echo on CLI | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-189911@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=42197&edit=1
ID: 42197
Updated by: aharvey@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:
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?
Previous Comments:
------------------------------------------------------------------------
[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.
------------------------------------------------------------------------
[2013-07-03 12:50:13] cweiske@php.net
Using ob_start() is a workaround, not a fix. Also, error messages are hidden when using ob_start().
------------------------------------------------------------------------
[2013-06-27 22:41:26] yohgaki@php.net
Just use ob_start().
$ ./sapi/cli/php
<?php
ob_start();
echo 'a';
header('sadf');
?>
a
------------------------------------------------------------------------
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