#42053 [Opn->Bgs]: code execution stops after header() - readfile()

From: Date: Fri, 20 Jul 2007 15:42:39 +0000
Subject: #42053 [Opn->Bgs]: code execution stops after header() - readfile()
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-115255@lists.php.net to get a copy of this message
ID: 42053 Updated by: johannes@php.net Reported By: gianluca dot sibaldi at 51factory dot com -Status: Open +Status: Bogus Bug Type: HTTP related Operating System: Windows NT WEBS44 5.2 build 3790 PHP Version: 4.4.7 New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php HTTP offers only one output stream -> You're writing to the file using your echo statement. Previous Comments: ------------------------------------------------------------------------ [2007-07-20 14:56:30] gianluca dot sibaldi at 51factory dot com 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 this bug report at http://bugs.php.net/?id=42053&edit=1

« previous php.bugs (#115255) next »