php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63895 ftell() returns wrong pointer position
Submitted: 2013-01-03 22:35 UTC Modified: 2013-01-03 23:27 UTC
From: bugzilla77 at gmail dot com Assigned:
Status: Not a bug Package: Streams related
PHP Version: 5.4.10 OS:
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: bugzilla77 at gmail dot com
New email:
PHP Version: OS:

 

 [2013-01-03 22:35 UTC] bugzilla77 at gmail dot com
Description:
------------
ftell() returns wrong pointer position

Test script:
---------------

<?php
 $f=fopen(__FILE__,'a'); // spec: 'a' place the file pointer at the end of the file
 print(ftell($f)); // spec: Returns the current position of the file read/write pointer
 fclose($f);
?>



Expected result:
----------------

__FILE__ size



Actual result:
--------------

zero



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-01-03 23:27 UTC] rasmus@php.net
-Status: Open +Status: Not a bug
 [2013-01-03 23:27 UTC] rasmus@php.net
This is quite clearly documented in the ftell() docs:

"ftell() gives undefined results for append-only streams (opened with "a" flag)."
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri May 09 14:01:27 2025 UTC