#33012 [Opn->Bgs]: fread/fopen error
ID: 33012
Updated by: tony2001@php.net
Reported By: justin at aofrozencity dot com
-Status: Open
+Status: Bogus
Bug Type: Filesystem function related
Operating System: Windows 2003 Server
PHP Version: 4.3.11
New Comment:
Set magic_quotes_runtime = Off.
No bug here.
Previous Comments:
------------------------------------------------------------------------
[2005-05-12 09:01:41] justin at aofrozencity dot com
I checked the image address (f182a80e96b6d4aa7be83a1a75e4672f.png).It
is located at
E:\vhosts\aofrozencity.net\httpdocs\images\image_system\security_image\images\tmp\).
It is correct.
test.php file is located at
"E:\vhosts\aofrozencity.net\httpdocs\images\image_system\security_image\"
You can check the orginal image file
(http://aofrozencity.net/images/image_system/bugs/f182a80e96b6d4aa7be83a1a75e4672f.png)
and image
(http://aofrozencity.net/images/image_system/bugs/test_php.png
) which is created by php with fwrite/fread.
Between the orginal image file and php image source aren't same.
test.php source here
<?
// Output PNG Image
$file = fopen("images/tmp/f182a80e96b6d4aa7be83a1a75e4672f.png", "r");
$source = fread($file ,
filesize('images/tmp/f182a80e96b6d4aa7be83a1a75e4672f.png'));
fclose($file);
header("Content-Type: image/png");
print($source);
?>
Result:The image
http://aofrozencity.net/images/image_system/security_image/test.php
cannot be displayed, because it contains errors.
------------------------------------------------------------------------
[2005-05-12 08:01:42] tony2001@php.net
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php
If you can provide more information, feel free to add it
to this bug and change the status back to "Open".
Thank you for your interest in PHP.
------------------------------------------------------------------------
[2005-05-12 05:59:59] justin at aofrozencity dot com
Description:
------------
I figured out why the problem is. I found out that fread/fopen doesn't
read image file exactly and properly because I checked orginal image
file code that isn't match the image file code which was from
fread/fopen.
Reproduce code:
---------------
// Output PNG Image
$file = fopen('images/tmp/'.$tmpname, 'rb');
$source = fread($file , filesize('images/tmp/'.$tmpname));
fclose($file);
header("Content-Type: image/png");
print($source);
Expected result:
----------------
"The image cannot be displayed, because it contains errors"
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=33012&edit=1
Thread (6 messages)