ID: 27851 Updated by: [EMAIL PROTECTED] Reported By: publicfreedom at yahoo dot com -Status: Open +Status: Bogus Bug Type: Filesystem function related Operating System: RedHat Linux PHP Version: 4.3.4 New Comment:
We have some new semantics in reading from files; but the old way was never really "supported" like you were doing. It's not a bug -> bogus. Previous Comments: ------------------------------------------------------------------------ [2004-04-03 05:50:51] publicfreedom at yahoo dot com Hello again, I found the solution on this link http://bugs.php.net/bug.php?id=24001&edit=2 I tested it and it worked, I am just wandering why or how the function was working on the previous php version(4.2.3)! Thank you to all supporters. ------------------------------------------------------------------------ [2004-04-03 04:10:35] publicfreedom at yahoo dot com Description: ------------ Hello, I have a php program that reads a file from a given URL and then recreates it on my server host using fopen, fread and fwrite. The program was running perfectly with php version 4.2.3 for the last 9 months, then when my hosting provider upgraded to php version 4.3.4 it produced the following bug: When the file URL is recreated it is sometimes not complete, i.e the number of bytes of the new recreated file is less than the original file which results in an incompleted or corrupted file. I reported my hosting provider with the bug, but they told me to contact php.net . Is there a fix for that? Please help. Here is a link to the part of the program that is not working. I have illustrated it clearly. http://ssviewpoint.com/filetest/index.php Thank you. Reproduce code: --------------- <? $fileurl ='http://www.google.com/intl/en_ALL/images/images_hp.gif'; $fd =fopen ($fileurl,"rb"); if (!$fd){ echo "<p><br>Unable to open remote file.<br> Name : <b>$fileurl<b>"; exit; } //if $fd $fs=8388608; //1Mb = 1048576 - now fs is 80 Mb $contents =fread ($fd,$fs); fclose ($fd); //Now the binary contents of file is in $contents $newfilename= 'googlefile.gif'; $fdffp =fopen($newfilename,"w"); fwrite($fdffp,$contents); fclose($fdffp); $thesize= filesize($newfilename); //$newfilename should be an identical copy of $fileurl and $thesize should be its size but it is not. ?> Expected result: ---------------- I expect to find an identical file of the file in the given URL, created on my host. Actual result: -------------- The new created file is less in size than the actual size which results in a corrupted file. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=27851&edit=1