|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #36289 Implement SplBinaryFileObject
Submitted: 2006-02-05 00:32 UTC Modified: 2016-10-25 17:30 UTC
Avg. Score:4.6 ± 0.7
Reproduced:19 of 19 (100.0%)
Same Version:7 (36.8%)
Same OS:9 (47.4%)
From: robertpaul at gmail dot com Assigned: cmb (profile)
Status: Closed Package: SPL related
PHP Version: * OS: *
Private report: No CVE-ID: None
 [2006-02-05 00:32 UTC] robertpaul at gmail dot com
Please forgive me if I'm missing something, but it seems as though SplFileObject has most of the useful file functions except fread.  Having that available would be Really Good?.



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-02-05 12:54 UTC]
SplFileObject is a line iterator, that is it reads the next line on current() and friends. Introducing fread would mean one would need to cound the '\n's after reading some bytes. That said it would be ok to read the remainder as from the object since then valid() would return true and the number of lines wouldn't matter. An alternative would be allowing to skip line counting. However right now fread() in its current forma does not make sense.
 [2006-02-05 16:52 UTC] robertpaul at gmail dot com
I see ... thanks for the quick reply. So is it fair to say, then, that SplFileObject isn't suitable for reading a binary file?

Thanks again,

 [2006-02-05 17:04 UTC]
Yes, maybe we can implement a SplBinaryFileObject class. That would have all those functions. Actually an interesting idea.
 [2010-11-24 15:16 UTC]
-Package: Feature/Change Request +Package: SPL related -PHP Version: 5.1.2 +PHP Version: *
 [2016-10-25 17:29 UTC]
-Status: Assigned +Status: Closed
 [2016-10-25 17:29 UTC]
As of PHP 5.5.11 SplFileObject::fread() is available, so this
ticket can be closed.
 [2016-10-25 17:30 UTC]
-Assigned To: helly +Assigned To: cmb
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Mon Aug 15 02:05:50 2022 UTC