|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2003-03-05 04:10 UTC] 4u at direct-netware dot de
>>> Description: fread (maybe in connection with fseek) do not read "length" bytes - example: @fseek (Resource id #113,75); @fread (Resource id #113,4633); Read bytes reported by strlen: 5 @fseek (Resource id #113,4750); @fread (Resource id #113,90); Read bytes reported by strlen: 90 @fseek (Resource id #113,4881); @fread (Resource id #113,5656); Read bytes reported by strlen: 169 @fseek (Resource id #113,10593); @fread (Resource id #113,5635); Read bytes reported by strlen: 104 @fseek (Resource id #113,16282); @fread (Resource id #113,1277); Read bytes reported by strlen: 1277 @fseek (Resource id #113,17601); @fread (Resource id #113,1415); Read bytes reported by strlen: 283 @fseek (Resource id #113,19083); @fread (Resource id #113,309); Read bytes reported by strlen: 167 > Example part of the script: @fseek ($zipp,$direct_tempdata_2array['zip_filebegin']); $direct_tempdata_4string = @fread ($zipp,$direct_tempdata_2array['zip_filesize_compressed']); >>> Modules: Seems to be not required for this bug report >>> Setup data: Windows XP PHP 4.3.1 and PHP 4.3.2-dev Apache 2.0.44 MySQL 4.0.11-gamma Administrative rights: yes PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Nov 06 18:00:01 2025 UTC |
I don't know if this is related, but I think so. Please tell me if I should better submit this as a new bug. The fseek teleports my file pointer to some strange places. I'm using Win2K (NT5 SP4) with administrative rights and I'm running EasyPhp 1.6.0.0 that contains PHP 4.2.0. But the same script works on Debian GNU/Linux 2.2.20 with PHP 4.1.2! Here's my example script (note that none of the two fseek methods work): function getChar($fp, &$c) { $c=fgetc($fp); if(feof($fp)) return false; return true; } $fp=fopen('parseTest.txt','r'); while(true) { $c=fgetc($fp); if(feof($fp)) break; echo("$c"); //fseek($fp, -1, SEEK_CUR); fseek($fp, ftell($fp)-1); $c=fgetc($fp); if(feof($fp)) break; echo("$c"); } fclose($fp); echo('<EOF>'); The file that I read contains just this: Hello World! The correct output on Debian GNU/Linux 2.2.20 with PHP 4.1.2: hheelllloo wwoorrlldd!! <EOF> The problematic output on Win2k with PHP 4.2.0: h<EOF> Ok that's it. Thank you for your support! :) Gabriel