From:             [EMAIL PROTECTED]
Operating system: Linux
PHP version:      4.3.0
PHP Bug Type:     Output Control
Bug description:  Header weirdness

OK, I had the following code:

<?
$counterfile = '/path/afile;
if (file_exists ($counterfile) == true )
{
        while (( $fp = fopen ($counterfile,"r+")) == false)
        { usleep(5);}
               while (!flock($fp,2))
        { usleep(5); }
        $data = fread($fp,filesize($counterfile));
        $content=explode(" ",$data);
        $content[1]=$content[1]+1;
        if (rewind($fp)!=0)
        {
                $data=implode(" ",$content);
                fwrite($fp,$data,strlen($data));
        }
        flock($fp,3);
        fclose($fp);
}
//header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT");    // Date in the
past
//header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
                                                      // always modified
//header ("Cache-Control: no-cache, must-revalidate");  // HTTP/1.1
//header ("Pragma: no-cache");                          // HTTP/1.0
header('Content-disposition: filename=setup.exe');
header('Content-type: application/octetstream');
header('Content-length: '.filesize('/path/setup.exe'));
readfile('/path/setup.exe');
?>

It worked before I upgraded to 4.3, so last version was 4.2 I used.

Now, its not doing the headers, its just showing the results of the
readfile.. (so my users reported major whine when they went to download my
app as I stupidly didnt check that one link)

v4.2 was compiled with 
Running PHP 4.2.2
Zend Engine v1.2.0, Copyright (c) 1998-2002 Zend Technologies

[PHP Modules]
xml
standard
sockets
session
posix
pcre
mysql
imap
ftp
dbase
ctype

v4.3 with

[PHP Modules]
Zend Optimizer
ctype
dbase
ftp
imap
mysql
overload
pcre
posix
session
sockets
standard
tokenizer
xml

[Zend Modules]
Zend Optimizer


(Optimizer irrelevant the 4.2 works with or without optimizer, 4.3
produces the same)
-- 
Edit bug report at http://bugs.php.net/?id=21496&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=21496&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=21496&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=21496&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=21496&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=21496&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=21496&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=21496&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=21496&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=21496&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=21496&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=21496&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=21496&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=21496&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=21496&r=gnused

Reply via email to