From:             [EMAIL PROTECTED]
Operating system: RH Linux 7.2 (kernel2.4.9-13smp)
PHP version:      4.1.1
PHP Bug Type:     Apache related
Bug description:  Printing header works only if followed by a print statement

The following script works when php is called from the command line:

<?php
print header("Location: http://www.yahoo.com/";);
exit;
?>

[myhost] php test.php
Location: http://www.yahoo.com/
Content-type: text/html

But when called via the Apache server (1.3.20), I get nothing (and nothing
in the error logs, so I don't think PHP is crashing):

[myhost] telnet localhost 80
Trying localhost...
Connected to localhost.
Escape character is '^]'.
GET /test.php HTTP/1.0

Connection closed by foreign host.

But if I print some non-empty string after I print the header, it works:

<?php
print header("Location: http://www.yahoo.com/";);
print "\n";
exit;
?>

[myhost] telnet localhost 80
Trying localhost...
Connected to localhost.
Escape character is '^]'.
GET /test.php HTTP/1.0

HTTP/1.1 302 Found
Date: Wed, 06 Feb 2002 21:01:52 GMT
Server: Apache/1.3.20 (Unix)  (Red-Hat/Linux) mod_ssl/2.8.4 OpenSSL/0.9.6b
DAV/1.0.2
Location: http://www.yahoo.com/
Connection: close
Content-Type: text/html

This is not restricted to the Location header; other headers do not
display either, unless followed by some non-null print statement.




-- 
Edit bug report at http://bugs.php.net/?id=15409&edit=1
-- 
Fixed in CVS:        http://bugs.php.net/fix.php?id=15409&r=fixedcvs
Fixed in release:    http://bugs.php.net/fix.php?id=15409&r=alreadyfixed
Need backtrace:      http://bugs.php.net/fix.php?id=15409&r=needtrace
Try newer version:   http://bugs.php.net/fix.php?id=15409&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=15409&r=support
Expected behavior:   http://bugs.php.net/fix.php?id=15409&r=notwrong
Not enough info:     http://bugs.php.net/fix.php?id=15409&r=notenoughinfo


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to