#42053 [NEW]: code execution stops after header() - readfile()

From: Date: Fri, 20 Jul 2007 14:56:31 +0000
Subject: #42053 [NEW]: code execution stops after header() - readfile()
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-115254@lists.php.net to get a copy of this message
From:             gianluca dot sibaldi at 51factory dot com
Operating system: Windows NT WEBS44 5.2 build 3790
PHP version:      4.4.7
PHP Bug Type:     HTTP related
Bug description:  code execution stops after header() - readfile()

Description:
------------
After executing a download process built with header() and print()
can't get any further output to browser page.

Reproduce code:
---------------
<?
$file = "my_file_to_dowload.txt";

header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: no-store");
header("Cache-Control: private",true);
header("Content-Type: application/octet-stream");
header('Content-Disposition: attachment; filename="'.$file.'"' );
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".filesize($file));

readfile($file)
  
echo("After I successfully downloaded the file, I can't see this line
printed in browser window...");
?>


Expected result:
----------------
I expect that the code just after
readfile($file)
is being executed.
In this case I wish to see in browser window the message sent with echo
().

Actual result:
--------------
Anything in php code which is after the block

header("string");
.....
readfile("string");

is ignored.
Exactly like the code was:

header("string");
....
readfile("string");
exit();



-- 
Edit bug report at http://bugs.php.net/?id=42053&edit=1
-- 
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=42053&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=42053&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=42053&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=42053&r=fixedcvs
Fixed in release:             http://bugs.php.net/fix.php?id=42053&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=42053&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=42053&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=42053&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=42053&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=42053&r=notwrong
Not enough info:              http://bugs.php.net/fix.php?id=42053&r=notenoughinfo
Submitted twice:              http://bugs.php.net/fix.php?id=42053&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=42053&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=42053&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=42053&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=42053&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=42053&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=42053&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=42053&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=42053&r=mysqlcfg


Thread (2 messages)

« previous php.bugs (#115254) next »