#34744 [Bgs]: system() forces Content-type header output
| From: | clewis at myfonts dot com | Date: | Thu, 06 Oct 2005 00:21:41 +0000 |
| Subject: | #34744 [Bgs]: system() forces Content-type header output | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-86073@lists.php.net to get a copy of this message | ||
ID: 34744
User updated by: clewis at myfonts dot com
Reported By: clewis at myfonts dot com
Status: Bogus
Bug Type: Output Control
Operating System: Windows XP, CentOS 4
PHP Version: 5.0.5
New Comment:
christian dot mueller at dfpx dot de says:
-------
I read "web server's OB" ... that is quite different from the "php OB
initiated with ob_start()" as reported in this Bug.
-------
I (original submitter) say:
It looks like I should be using passthru() instead of system().
Nonetheless it is confusing that system() completely ignores the PHP
output buffer.
Previous Comments:
------------------------------------------------------------------------
[2005-10-05 23:07:24] sniper@php.net
RTFM: "The system() call also tries to automatically flush the web
server's output buffer after each line of output if PHP is running as a
server module."
------------------------------------------------------------------------
[2005-10-05 22:06:13] clewis at myfonts dot com
I'm using Apache 2 APXS module on both Windows XP SP2 and CentOS 4.1
(like RHEL 4), if that helps.
------------------------------------------------------------------------
[2005-10-05 21:37:40] sniper@php.net
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.
------------------------------------------------------------------------
[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