ID:               23056
 User updated by:  dan1 at edenpics dot com
 Reported By:      dan1 at edenpics dot com
-Status:           Bogus
+Status:           Open
 Bug Type:         Output Control
 Operating System: Linux RedHat 7.1
 PHP Version:      4.3.2RC1
 New Comment:

Yes, the bird was in JPEG before, I changed it in GIF, to be more
coherent with the code. It's because I tested several formats, sorry
for this incovenience. However, the bug appears in GIF or JPEG, so the
bug is the same now.

I just found out that the bug comes out only if we sent the
"Cache-Control" header along with the picture, which is something I
forgot to mention in my previous code, because I thought that it was
not relevant. In fact, THIS IS the problem.

So here is the code that really generates the bug:

<?
header("Content-type: image/gif");
header("Cache-Control: no-cache, must-revalidate");
$output="bird.gif"; // file name
$fd = fopen($output,"r");
$filelength=filesize($output);
$contents = fread($fd,$filelength);
echo $contents; fclose($fd);
?>

If you comment out the Cache-Control header line, everything works
fine, so this is a workaround. However, I think that it is still a PHP
bug, don't you ?
Please try again (1 minute), I updated the report page:
http://www.edenpics.com/pub/iebug/iebug2.phtml

Thank you.


Previous Comments:
------------------------------------------------------------------------

[2003-04-05 11:13:29] [EMAIL PROTECTED]

Disclaimer: the bird.gif _WAS_ jpeg before.. :)


------------------------------------------------------------------------

[2003-04-05 11:12:22] [EMAIL PROTECTED]

the example bird.gif is actually JPEG, not GIF..
And when having the correct script with correct imagetype,
this all works just fine.

This is NOT any bug in PHP.


------------------------------------------------------------------------

[2003-04-05 00:28:33] [EMAIL PROTECTED]

I copied your script directly and found a bird.gif image out there. 
You can see the result at:
http://lerdorf.com/bird.php
Source code at:
http://lerdorf.com/bird.phps
Works ok for me.  Perhaps you have something before or after the
start/end php tags, or do you have weird line endings or something?  Do
an "od -c bird.php" and compare it to:
http://lerdorf.com/bird.txt


------------------------------------------------------------------------

[2003-04-04 12:55:43] dan1 at edenpics dot com

Something more: this happens with all versions of Internet Explorer

------------------------------------------------------------------------

[2003-04-04 12:21:28] dan1 at edenpics dot com

Sorry, $output is the file name.
here is the correct code:

<?
header("Content-type: image/gif");
$output="bird.gif"; // file name
$fd = fopen($output,"r");
$filelength=filesize($output);
$contents = fread($fd,$filelength);
echo $contents; fclose($fd);
?>

I tried PHP version 4.3.2RC1. The same happens.
This bug appears with jpeg (.jpg) files too, with the "e99\r\n" code
before the picture datas, and they can only be saved as BMP too.

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/23056

-- 
Edit this bug report at http://bugs.php.net/?id=23056&edit=1

Reply via email to