Bug #51997 [Asn->Csd]: fseek($fp, 0, SEEK_CUR) generates needless warning when seeking isn't supported
Edit report at http://bugs.php.net/bug.php?id=51997&edit=1
ID: 51997
Updated by: iliaa@php.net
Reported by: andrew at bramp dot freeserve dot co dot uk
Summary: fseek($fp, 0, SEEK_CUR) generates needless warning
when seeking isn't supported
-Status: Assigned
+Status: Closed
Type: Bug
Package: Streams related
Operating System: Linux
PHP Version: 5.3.2
Assigned To: cataphract
Block user comment: N
Private report: N
New Comment:
This bug has been fixed in SVN.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2011-06-05 23:57:04] iliaa@php.net
Automatic comment from SVN on behalf of iliaa
Revision: http://svn.php.net/viewvc/?view=revision&revision=311849
Log: Fixed bug #51997 (SEEK_CUR with 0 value, returns a warning).
------------------------------------------------------------------------
[2010-06-05 01:39:51] 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.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=51997&edit=1
Thread (2 messages)