php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #42053 code execution stops after header() - readfile()
Submitted: 2007-07-20 14:56 UTC Modified: 2007-07-20 15:42 UTC
From: gianluca dot sibaldi at 51factory dot com Assigned:
Status: Not a bug Package: HTTP related
PHP Version: 4.4.7 OS: Windows NT WEBS44 5.2 build 3790
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: gianluca dot sibaldi at 51factory dot com
New email:
PHP Version: OS:

 

 [2007-07-20 14:56 UTC] 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();



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-07-20 15:42 UTC] johannes@php.net
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.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 12:01:31 2024 UTC