|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #5859 fseek() with whence SEEK_CUR wrong
Submitted: 2000-07-30 12:14 UTC Modified: 2000-07-30 12:21 UTC
From: ccjeagle at ms6 dot hinet dot net Assigned:
Status: Closed Package: Other
PHP Version: 4.0.1pl2 OS: FreeBSD-4.1RC
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: ccjeagle at ms6 dot hinet dot net
New email:
PHP Version: OS:


 [2000-07-30 12:14 UTC] ccjeagle at ms6 dot hinet dot net
// Begin of my.txt
// End of my.txt

With the script :
// Begin of test.php
$fp = fopen("my.txt","r") ;
echo fseek($fp,3) ; echo fgetc($fp) ;
echo fseek($fp,0,SEEK_CUR) ; echo fgetc($fp) ;
fclose($fp) ;
// End of test

The result would be '0405', which should be 
wrong with offset 0 with SEEK_CUR.



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2000-07-30 12:21 UTC]
I think it is correct. The fgetc gets a character from file and advances the filepointer, si that the next time you do a fgetc you'll get the next chracter. After the first fgetc the filepointer is already on position 4 ('5') and so fseek ($fp, 0, SEEK_CUR) ideed does nothing.

PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Tue Feb 07 16:03:54 2023 UTC