#34744 [Opn->Fbk]: system() forces Content-type header output
| From: | sniper@php.net | Date: | Wed, 05 Oct 2005 19:37:41 +0000 |
| Subject: | #34744 [Opn->Fbk]: system() forces Content-type header output | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-86059@lists.php.net to get a copy of this message | ||
ID: 34744
Updated by: sniper@php.net
Reported By: clewis at myfonts dot com
-Status: Open
+Status: Feedback
Bug Type: Output Control
Operating System: Windows XP, CentOS 4
PHP Version: 5.0.5
New Comment:
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php
If you can provide more information, feel free to add it
to this bug and change the status back to "Open".
Thank you for your interest in PHP.
Previous Comments:
------------------------------------------------------------------------
[2005-10-05 20:53:56] clewis at myfonts dot com
Description:
------------
Calling the system() function forces the standard Content-type:
text/html header output, even when output buffering is on. This
behaviour is unlike other output commands such as print, which suppress
the "automatic" headers until the output buffer is flushed.
Note that replacing system() with print() in the sample code works as
expected.
Reproduce code:
---------------
<?php
ob_start();
chdir("/");
system("ls");
ob_end_clean();
header("Content-type: text/plain");
print "Hello World.";
?>
Expected result:
----------------
Content-type: text/plain
Hello World.
Actual result:
--------------
Content-type: text/html
Warning: Cannot modify header information - headers already sent...
Hello World.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=34744&edit=1