|  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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
45 - 28 = ?
Subscribe to this entry?

 [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-2024 The PHP Group
All rights reserved.
Last updated: Tue Jun 25 00:01:31 2024 UTC