Req #42197 [Opn]: header() cannot be used after echo on CLI

From: Date: Sat, 10 Jan 2015 13:21:46 +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-189858@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:         cweiske@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:

@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".


Previous Comments:
------------------------------------------------------------------------
[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

------------------------------------------------------------------------
[2007-08-04 14:03:29] jani@php.net

Reclassified.

------------------------------------------------------------------------


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


Thread (11 messages)

« previous php.bugs (#189858) next »