fseek($fp, 0, SEEK_CUR) generates needless warning when seeking isn't supported
| Bug #51997 | fseek($fp, 0, SEEK_CUR) generates needless warning when seeking isn't supported | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Submitted: | 2010-06-05 01:39 UTC | Modified: | 2011-06-05 23:57 UTC |
|
||||||
| From: | andrew at bramp dot freeserve dot co dot uk | Assigned: | cataphract (profile) | |||||||
| Status: | Closed | Package: | Streams related | |||||||
| PHP Version: | 5.3.2 | OS: | Linux | |||||||
| Private report: | No | CVE-ID: | None | |||||||
[2010-06-05 01:39 UTC] andrew at bramp dot freeserve dot co dot uk
Description:
------------
This is such a minor "bug" which can easily be fixed with one minor change.
The bzip stream for example, does not support seeking, however this is an
"emulation" in main/streams/streams.c that allows the SEEK_CUR to work with
positive values by just continue to read for the seek duration.
The bug is if you use SEEK_CUR with a value of zero, a warning pops up saying
seek is not supported. I know using a value of zero is perhaps wrong, but by
changing line 1150 of main/streams/streams.c from:
if (whence == SEEK_CUR && offset > 0) {
to:
if (whence == SEEK_CUR && offset >= 0) {
then this warning does not appear, and everything works as expected.
I have not tested this change, but it looks innocent enough. Until then I'm
writing my PHP code with a if ($offset > 0) fseek($fp, $offset, SEEK_CUR);
thanks.
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2011-06-05 23:57 UTC] iliaa@php.net
-Status: Assigned +Status: Closed
[2011-06-05 23:57 UTC] iliaa@php.net